BUG: ADO Error 800a0cc1 Using SetSQLText or SetRecordSource (190589)



The information in this article applies to:

  • Microsoft Visual InterDev 6.0

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.

/<web project>/_ScriptLibrary/Recordset.ASP, line 456
-or-

ADODB.Command (0x800A0CC1)

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

/<web project>/_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.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a project with a data connection.
  2. Add a page.
  3. Add a recordset to the page.
  4. Bind the recordset to a stored procedure that takes parameters.
  5. Set the parameters in the Parameters tab.
  6. 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
    					

Modification Type:MinorLast Reviewed:3/2/2005
Keywords:kbBug kbCtrl kbDatabase kbDSupport KB190589