Solved

ADO Error 800a0bb9 - Connection Error

Posted on 1999-01-11
23
406 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:gcw
  • 12
  • 11
23 Comments
 
LVL 3

Expert Comment

by:idt
ID: 1455515
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
0
 

Author Comment

by:gcw
ID: 1455516
sorry, line 12 was
Class.Open Query,Connect,adOpenDynamic,adLockOptimistic %>
0
 

Author Comment

by:gcw
ID: 1455517
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>

0
 
LVL 3

Expert Comment

by:idt
ID: 1455518
try
Class.CursorType = adOpenStatic

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

Author Comment

by:gcw
ID: 1455519
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??

0
 
LVL 3

Expert Comment

by:idt
ID: 1455520
tabs and enter keys are funny things..
the next line of that comment was unremark:
Class.LockType = adLockOptimistic
0
 
LVL 3

Expert Comment

by:idt
ID: 1455521
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..
0
 
LVL 3

Expert Comment

by:idt
ID: 1455522
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>

0
 

Author Comment

by:gcw
ID: 1455523
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.
0
 
LVL 3

Expert Comment

by:idt
ID: 1455524
:{
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.
0
 
LVL 3

Expert Comment

by:idt
ID: 1455525
Wait!
does this table have a primary index?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:gcw
ID: 1455526
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??
0
 
LVL 3

Expert Comment

by:idt
ID: 1455527
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
0
 

Author Comment

by:gcw
ID: 1455528
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
0
 
LVL 3

Expert Comment

by:idt
ID: 1455529
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
%>

0
 

Author Comment

by:gcw
ID: 1455530
same error :( (original  conflict error)
0
 

Author Comment

by:gcw
ID: 1455531
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?
0
 
LVL 3

Expert Comment

by:idt
ID: 1455532
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

0
 

Author Comment

by:gcw
ID: 1455533
Yes I did try your code.. you will have the DB shortly.
0
 
LVL 3

Accepted Solution

by:
idt earned 150 total points
ID: 1455534
<%@ LANGUAGE = VBScript %>
<%  Option Explicit            %>

<%
'!!!!YiPEEEE! Problem Solved!!!!
'
'Ok, advice number 1
'Always use Option Explicit, this way if you use a constant or variable, it will check if it is defined.. else your constants and vars are interpreted as ZEROs!
'
'Change the gwc.dsn to your dsn name and then run this page with webname.asp?A=SOMEJUNK
'
%>


<%
      '---- CursorTypeEnum Values ----
      Const adOpenForwardOnly = 0
      Const adOpenKeyset = 1
      Const adOpenDynamic = 2
      Const adOpenStatic = 3

      '---- LockTypeEnum Values ----
      Const adLockReadOnly = 1
      Const adLockPessimistic = 2
      Const adLockOptimistic = 3
      Const adLockBatchOptimistic = 4

      'for add record
      Dim AConnect
      Dim AClass

      'for output section
      Dim SQLstatement
      Dim QRows
      Dim NewRecordSet

      Set AConnect = Server.CreateObject("ADODB.Connection")
      AConnect.Open "FILEDSN=gwc.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") = Request.QueryString("A")
      AClass.Update
      AClass.Close

      'output section
      SQLstatement="SELECT * FROM EditionPages WHERE LaNote="+"'"+Request.QueryString("A")+"'"
      Set NewRecordSet = AConnect.Execute(SQLstatement,QRows)
      Response.Write("<HTML><HEAD></HEAD><BODY>IDT is the King!<BR><BR>")
      Do While NOT NewRecordSet.eof
        Response.Write(NewRecordSet("LaNote")+"<BR>")
        NewRecordSet.MoveNext
      Loop
      Response.Write("</BODY></HTML>")
      NewRecordSet.Close
      AConnect.Close
%>

0
 

Author Comment

by:gcw
ID: 1455535
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!!!
0
 

Author Comment

by:gcw
ID: 1455536
ooopps forgot to grade
0
 
LVL 3

Expert Comment

by:idt
ID: 1455537
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 %>

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now