BUG: ADO Error 800a0cc1 Using SetSQLText Or SetRecordSource
ID: Q190589
|
The information in this article applies to:
-
Microsoft Visual InterDev, version 6.0
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.
/kb/_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 this to be a bug in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
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.
- 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
Additional query words:
Keywords : kbADO kbVisID kbVisID600bug kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug