Article ID: 254517
Article Last Modified on 8/23/2001
APPLIES TO
- Microsoft ActiveX Data Objects 1.5
- Microsoft ActiveX Data Objects 2.0
- Microsoft ActiveX Data Objects 2.01
- Microsoft ActiveX Data Objects 2.1
- Microsoft ActiveX Data Objects 2.1 Service Pack 1
- Microsoft ActiveX Data Objects 2.1 Service Pack 2
- Microsoft ActiveX Data Objects 2.5
- Microsoft ActiveX Data Objects 2.6
- Microsoft ActiveX Data Objects 2.7
This article was previously published under Q254517
SYMPTOMS
When you view an Active Server Pages (ASP) page that makes parameterized calls to ASP objects, the following error message appears:
This is often an ADODB.Recordset error.
CAUSE
This problem is often caused by the code using ADO constants that have not been defined for the page. For example:
<% set cn=server.CreateObject("ADODB.Connection") CN.Open "DSN=Gallery" set rs=Server.CreateObject("ADODB.Recordset") rs.Open "Select * From Customers", CN, adOpenStatic, adLockOptimistic %>
ASP does not inherently know the values of ADO constants, and therefore the two constants (in this case adOpenStatic and adLockOptimistic) are empty.
RESOLUTION
There are several different ways that you can work around this problem:
Use the actual constant values:
<% set cn=server.CreateObject("ADODB.Connection") CN.Open "DSN=Gallery" set rs=Server.CreateObject("ADODB.Recordset") rs.Open "Select * From Customers", CN, 3, 3 %>
Set the constants:
<% Const adOpenStatic = 3 Const adLockOptimistic = 3 set cn=server.CreateObject("ADODB.Connection") CN.Open "DSN=Gallery" set rs=Server.CreateObject("ADODB.Recordset") rs.Open "Select * From Customers", CN, adOpenStatic, adLockOptimistic %>
Include the Adovbs.inc file with all the constants. You can copy the Adovbs.inc file to your Web projects directory on the Web server from [drive]:\Program files\Common files\System\ADO.
<!--#include file="adovbs.inc"--> <% set cn=server.CreateObject("ADODB.Connection") CN.Open "DSN=Gallery" set rs=Server.CreateObject("ADODB.Recordset") rs.Open "Select * From Customers", CN, adOpenStatic, adLockOptimistic %>
- If the page is part of a project that was written in Microsoft Visual InterDev, you can set a reference to the ADO type libraries in the project by following these steps:
- Open the project in Visual InterDev.
- From the Project menu in Visual InterDev, choose Project References.
- In the References dialog box, select Microsoft ActiveX Data Objects Library and click OK.
REFERENCES
For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
190743 PRB: ADODB.Recordset Error '800a0bb9' When Using Boolean Filter
235892 PRB: 800a0bb9 Error Message When Applying a Filter to an ADO Recordset
197323 HOWTO: Troubleshoot "ADODB.Connection" Error 800a0bb9 from Recordset DTC
Additional query words: error 800a0bb9
Keywords: kbexcel123quattro kbprb KB254517