ReadyState Property Example (VBScript)

Microsoft ActiveX Data Objects (ADO)

RDS 2.5 API Reference

ReadyState Property Example (VBScript)

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> and </Body> tags in a normal HTML document and name it RDSReadySt.asp. Use Find to locate the file Adovbs.inc and place it in the directory you plan to use. ASP script will identify your server.

<!-- BeginReadyStateVBS -->

<%@ Language=VBScript %>

<% 'use the following META tag instead of adovbs.inc%>

<!--METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->

<html>

<head>

<meta name="VI60_DefaultClientScript" content=VBScript>

<meta name="GENERATOR" content="Microsoft Visual Studio 6.0">

<title>RDS.DataControl ReadyState Property</title>

<style>

<!--

body {

font-family: 'Verdana','Arial','Helvetica',sans-serif;

BACKGROUND-COLOR:white;

COLOR:black;

}

.thead {

background-color: #008080;

font-family: 'Verdana','Arial','Helvetica',sans-serif;

font-size: x-small;

color: white;

}

.thead2 {

background-color: #800000;

font-family: 'Verdana','Arial','Helvetica',sans-serif;

font-size: x-small;

color: white;

}

.tbody {

text-align: center;

background-color: #f7efde;

font-family: 'Verdana','Arial','Helvetica',sans-serif;

font-size: x-small;

}

-->

</style>

</head>

<body>

<H1>RDS.DataControl ReadyState Property</H1>

<H2>RDS API Code Examples </H2>

<HR>

<!-- RDS.DataControl with parameters set at design time -->

<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID=RDS>

<PARAM NAME="SQL" VALUE="Select * from Orders">

<PARAM NAME="SERVER" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">

<PARAM NAME="CONNECT" VALUE="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'">

<PARAM NAME="ExecuteOptions" VALUE="2">

<PARAM NAME="FetchOptions" VALUE="3">

</OBJECT>

<TABLE DATASRC=#RDS>

<TBODY>

<TR>

<TD><SPAN DATAFLD="OrderID"></SPAN></TD>

</TR>

</TBODY>

</TABLE>

<Script Language="VBScript">

Sub Window_OnLoad

Select Case RDS.ReadyState

case 2 'adcReadyStateLoaded

MsgBox "Executing Query"

case 3 'adcReadyStateInteractive

MsgBox "Fetching records in background"

case 4 'adcReadyStateComplete

MsgBox "All records fetched"

End Select

End Sub

</Script>

</body>

</html>

<!-- EndReadyStateVBS -->

See Also

DataControl Object (RDS) | ReadyState Property (RDS)

© 1998-2003 Microsoft Corporation. All rights reserved.