Microsoft KB Archive/190589

= BUG: ADO Error 800a0cc1 Using SetSQLText or SetRecordSource =

Article ID: 190589

Article Last Modified on 3/2/2005

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q190589



SYMPTOMS
Attempting to use setSQLText or setRecordSource on a recordset that is bound to a stored procedure gives the following ActiveX Data Objects (ADO) error:

ADODB.Parameters error '800a0cc1'

ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application.

/ /_ScriptLibrary/Recordset.ASP, line 456

-or-

ADODB.Command (0x800A0CC1)

Item cannot be found in the collection corresponding to the requested name or ordinal.

/ /_ScriptLibrary/Recordset.ASP, line 456



CAUSE
The recordset sets its parameters before opening the recordset. Even though the database object has changed, the routine that sets the parameters is still called.



RESOLUTION
There are two workarounds for this:
 * Use different recordset DTCs for the stored procedure and the new record source.

-or-
 * Do not set the parameter for the stored procedure in the Parameters tab. Instead, set the parameter programmatically. Note that if you use this workaround, you need to know which state your recordset is in, so you can avoid setting the parameter after changing the recordSource/SQLText.

In a DHTML page, setting the parameter programmatically will not work. Consider using two recordset DTCs.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a project with a data connection. Add a page. Add a recordset to the page. Bind the recordset to a stored procedure that takes parameters. Set the parameters in the Parameters tab.</li>  Use either setSQLText or setRecordSource to change the record source as in this example: If Recordset1.isOpen then Recordset1.close Recordset1.setSQLText("SELECT * FROM employee") Recordset1.open </li></ol>

Keywords: kbbug kbdatabase kbctrl kbpending KB190589

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.