Link to home
Start Free TrialLog in
Avatar of gcw
gcw

asked on

ADO Error 800a0bb9 - Connection Error

I am getting the following message when attempting to connect to an access DB with the following code. Has anyone had this problem? If so do you know how I can fix it?

Error Text:
ADODB.Recordset error '800a0bb9'

The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

/openpg.asp, line 12

END Error Text

Begin Code for this page

<%Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Pager"
Set Class = Server.CreateObject("ADODB.Recordset")
Query = "SELECT PageSection FROM EditionPages"
Class.Open Query,Connect,adOpenDynamic,adLockOptimistic %>

END Code for this page

The "Pager" DNS does work. I have been able to perform straight queries, but have been usuccessful with this code.

Any Help will be appreciated
Avatar of idt
idt

It would help if you identified which line is line 12..

Set AConnection = Server.CreateObject("ADODB.Connection")
AConnection.Open "FILEDSN=Pager.dsn"
Set ARecordSet = Server.CreateObject("ADODB.Recordset")
Set ARecordSet.ActiveConnection = AConnection
ARecordSet.Source = "SELECT * EditionPages"
ARecordSet.CursorType = adOpenDynamic
ARecordSet.LockType = adLockOptimistic      
ARecordSet.Open
.
.your record work...
.
ARecordSet.Close
AConnection.Close


Let me know
Avatar of gcw

ASKER

sorry, line 12 was
Class.Open Query,Connect,adOpenDynamic,adLockOptimistic %>
Avatar of gcw

ASKER

I narrowed the problem down to the LockType line. I commented that line out and the error went away.. however I get a new error which follows (full code will follow error) (line 18 is Class.AddNew etc...)

ADODB.Recordset error '800a0cb3'

The operation requested by the application is not supported by the provider.

/openpg.asp, line 18


Code (Complete Page)
<html>

<head>
<title>Page Specs</title>
</head>

<body>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "FILEDSN=Pager.dsn"
Set Class = Server.CreateObject("ADODB.Recordset")
Set Class.ActiveConnection = Connect
Class.Source = "SELECT * FROM EditionPages WHERE PageSection =" & "'" & Request("pageitem")&"'"
Class.CursorType = adOpenDynamic
'Class.LockType = adLockOptimistic
Class.Open
myitem = Class("EditionDate")
<Line 18> Class.AddNew
Class("LaNote") = "I just did this one just now so there"
Class.Update
 %>
<%=myItem%>
</body>
</html>

try
Class.CursorType = adOpenStatic

and I noticed you had this line remarked out?
'Class.LockType = adLockOptimistic
Avatar of gcw

ASKER

the line
' and I noticed you had this line remarked out?
  'Class.LockType = adLockOptimistic '

is what was causing the first error.. about a conflict

I also tried changing to adOpenStatic... same problem (both errors) Should I have a Global.ASA file?? I found an article on the Knowlege Base about a global.asa file. But I have no clue as to what to put in it. Any Ideas??

tabs and enter keys are funny things..
the next line of that comment was unremark:
Class.LockType = adLockOptimistic
give me the details in your DSN file.. could be a problem there..

The code you are now using to do the insert is the same as I use in one of my asp file.. no I don't have a Global.ASA file.. and no, you don't need a global.asa file..
This is an example global.asa file used in a ms example site

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Session_OnStart
  On Error Resume Next
  ' Determine if we are using IE and set session variable to major version number
  On Error Resume Next
  Dim br
  Set br = Server.CreateObject("MSWC.BrowserType")
  If Err.Number = 0 Then
    If br.browser = "IE" Then
      Session("IEVersion") = CInt(br.majorver)
    End If
  End If
  'Set session variable for whether to generate pages using RDS (such as DetailInsurance.asp)
  If Session("IEVersion") >= 4 And Application("RDSAvailable") = "True" Then
    Session("UseRDS") = "True"
  Else
    Session("UseRDS") = "False"
  End If
End Sub
Sub Application_OnStart
      On Error Resume Next
      ' Note that this application assumes that the dsn specified in prefs.txt is in
      '   the ODBC default directory for file DSN locations.
      ' If RDS not available on your server, you should change "RDSAvailable" value in
      '   prefs.txt to "False"!
      Application.Lock
      ' Use the Prefs.txt file to set Application Variables.      
      Dim stTextLine, intEqualPosition, stVarName, stVarValue, fso, txtSettings
      Set fso = Server.CreateObject("Scripting.FileSystemObject")
      set txtSettings = fso.OpenTextFile(Server.MapPath("Prefs.txt"))
      Do Until txtSettings.AtEndOfStream
            stTextLine = txtSettings.ReadLine
            intEqualPosition = Instr(1, stTextLine, "=")
            If intEqualPosition <> 0 Then
              stVarName = Left(stTextLine, intEqualPosition - 1)
              stVarValue = Right(stTextLine, len(stTextLine) - intEqualPosition)
              Application(stVarName) = stVarValue
            End If
      Loop
      Application.Unlock
End Sub
</SCRIPT>

Avatar of gcw

ASKER

Here are my Pager.DSN settings

-Advanced Settings -

Default Authorization Frame:
Login Name = <none>
Password = <none>

Options Frame:
DefaultDir = C:\
Driver = {Microsoft Access Driver (*.mdb)}
FIL = MS Access
ImplicitCommitSync = Yes
MaxBufferSize = 512
MaxScanRows = 8
PageTimeout = 5
ReadOnly = 0
SafeTransaction = 0
Threads = 3
UserCommitSync = Yes

Options Frame - Main Window

Driver Frame
PageTimeout = 5
Buffer Size = 512
Exclusive = 0
ReadOnly = 0

These are all the options I could find.
:{
OK, you've stumped me..

check a few things before I give up.. could you have other Recordsets active against this same database?
Maybe a script that completes before Recordset.close?
same thing for TheConnection..

btw.. you can edit the .dsn file with a text editor, much easier see the settings.
Wait!
does this table have a primary index?
Avatar of gcw

ASKER

To answer the first comment. No, there are no other queries or statments for this page.. this is the only one.

To the second comment. Yes the primary key is 'ID' which is an autonumber.

Just for the heck of mentioning it.. does using FrontPage98 cause any problems with ADO??
I don't think FrontPage should have any effect, while I had it installed on my system I never detected any problem.

Just for the hell of it, try to create a new table with an integer index and see if it works then.

Other than that my fiend, I'm afraid I'm out of options. While I do use ODBC, I don't use it to connect to Access tables, although everything is in theory the same.

Sorry for not helping, I'll keep thinking about this as I sleep
Avatar of gcw

ASKER

please.. don't lose sleep over it... I just wanted an easier way of adding and updating data without having to use the INSERT INTO and UPDATE commands. I will keep pluggin.. I appreciate all the help!

gcw
Please try this code with these var names with this query

<%
Dim AConnect
Dim AClass

Set AConnect = Server.CreateObject("ADODB.Connection")
AConnect.Open "FILEDSN=Pager.dsn"
Set AClass = Server.CreateObject("ADODB.Recordset")
Set AClass.ActiveConnection = AConnect
AClass.Source = "SELECT * FROM EditionPages WHERE 1=2"
AClass.CursorType = adOpenStatic
AClass.LockType = adLockOptimistic
AClass.Open
AClass.AddNew
AClass("LaNote") = "I just did this one just now so there"
AClass.Update
%>

Avatar of gcw

ASKER

same error :( (original  conflict error)
Avatar of gcw

ASKER

what version of IIS are you running?? Do you have InterDev installed on the server or on a workstation? I am using IIS 4.0 that I got from the 4.0 Option Pack.  I did the mdac update to odbc. I am running InterDev on a workstation. Not installed on the server. Could this be an issue?
I am running IIS4 same as you from the Options Pak, I am not using InterDev.
Try a pessimistic (spellcheck) lock,
Did you run the exact code I posted in the last comment, just checking as I was sure that would work.

As I see nobody else has offered any help, I would like to keep working on this. Is it possible to get a copy of you database? I don't have the Access program installed so I can't make the table, but I do have the ODBC driver installed, so if I had your mdb files and your dsn file I could put it on my machine and run some tests quite quickly.

You could email as attachments to: job_gcw@distributel.net

Avatar of gcw

ASKER

Yes I did try your code.. you will have the DB shortly.
ASKER CERTIFIED SOLUTION
Avatar of idt
idt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gcw

ASKER

That worked!! the SQL part anyway.. I did get an "Expected Statment" error with the "Option Explicit" statement though.. Otherwise I am now in business.. I upped points cause you stuck with it.. thanks!!!
Avatar of gcw

ASKER

ooopps forgot to grade
You are a gentleman, thanks for recognizing the effort, I do appreciate it.

As a note, these lines need to be first in the file to do any good
<%@ LANGUAGE = VBScript %>
<%  Option Explicit %>