BUG: Recordset Commands Must Wait Until Ondatasetcomplete

ID: Q190594


The information in this article applies to:


SYMPTOMS

You may see the following error appear:

A Runtime Error has occurred.
Do you wish to debug?

Line 630
Error: The operation requested by the application is not allowed if the object is closed.
This error is most likely to occur on a DHTML page and will happen most often with large database objects.


CAUSE

The recordset is not fully loaded in memory at this point.


RESOLUTION

Wait until the ondatasetcomplete event fires before continuing.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

Wait until the ondatasetcomplete event to use the results from the newly opened recordset, like this:


   <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
   <!--
   function Button1_onclick() {

      Recordset1.open();

   }

   function fillValue()  {
      Textbox1.value = Recordset1.fields.getValue(0);
   }

   function Recordset1_ondatasetcomplete() {
      fillValue();
   }

   //-->
   </SCRIPT> 

Steps to Reproduce Behavior

The following steps will normally produce this error. The error is more likely to occur when the following are true:
  1. Create a project.


  2. Add a data connection.


  3. Add an HTML page.


  4. Place a recordset DTC, a text box DTC, and a button DTC on the page.


  5. Bind the recordset DTC to a database object.


  6. Add an event for Button1_onclick:
    
          function Button1_onclick() {
             Recordset1.open();
             Textbox1.value = Recordset1.fields.getValue(0);
          } 


  7. Browse the page and click the button.


Additional query words:


Keywords          : kbADO kbVisID600bug kbGrpASP 
Version           : WINDOWS:6.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 13, 1999