BUG: Recordset Commands Must Wait Until the Ondatasetcomplete Event Fires (190594)



The information in this article applies to:

  • Microsoft Visual InterDev 6.0

This article was previously published under Q190594

SYMPTOMS

You may receive the following error message:
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 Dynamic HTML (DHTML) page and most often occurs with large database objects.

CAUSE

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

RESOLUTION

Wait until the ondatasetcomplete event fires before you continue.

STATUS

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

MORE INFORMATION

Wait until the ondatasetcomplete event fires to use the results from the newly opened recordset. For example:
   <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 under the following conditions:

  • The database object (table, view, and so forth) is large.
  • The client computer is fast.
  • The connection to the database server is slow.
  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 as follows:
          function Button1_onclick() {
             Recordset1.open();
             Textbox1.value = Recordset1.fields.getValue(0);
          }
    					
  7. Browse to the page, and click the button.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbCtrl kbDatabase kbDSupport KB190594