Microsoft KB Archive/254517

= PRB: 800a0bb9 Error: "Application Is Using Arguments That Are of the Wrong Type" =

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:

error '800a0bb9'

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

/ProjectName/Page.asp, line X

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. <% 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.</li> In the References dialog box, select Microsoft ActiveX Data Objects Library and click OK.</li></ol> </li></ul>

<div class="references_section">