MDAC 2.5 SDK - ADO


 

ReadyState Property Example (VBScript)

See Also

The following example shows how to read the ReadyState property of the RDS.DataControl object at run time in VBScript code. ReadyState is a read-only property.

To test this example, cut and paste this code between the <Body></Body> tags in a normal HTML document and name it RDSReadySt.asp. ASP script will identify your server.

<<%@ Language=VBScript %>
<H2>RDS API Code Examples </H2>
<HR>
<H3>RDS.DataControl ReadyState Property</H3>
<!-- RDS.DataControl with parameters set at design time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
   ID=RDS>
   <PARAM NAME="SQL" VALUE="Select * from Employee for browse">
   <PARAM NAME="SERVER" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">
   <PARAM NAME="CONNECT" VALUE="Provider=SQLOLEDB;User Id=rdsdemo;Password=rdsdemo;Initial Catalog=AddrBookDB">
   <PARAM NAME="ExecuteOptions" VALUE="adcExecAsync"> 
   <PARAM NAME="FetchOptions" VALUE="adcFetchAsync">
</OBJECT>

<Script Language="VBScript">

Sub Window_OnLoad
   Select Case RDS.ReadyState
      case 2: MsgBox "Executing Query"
      case 3: MsgBox "Fetching records in background"
      case 4: MsgBox "All records fetched"
   End Select
End Sub
</Script>