Refresh Method Example (VBScript)
In this article
The following example shows how to set the necessary parameters of RDS.DataControl at run time. The manner in which a Recordset is retrieved using the Refresh method is determined by the settings of the ExecuteOptions and FetchOptions properties. To test this example, cut and paste the following code into a normal ASP document and name it RefreshVBS.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.
<!--use the following META tag instead of adovbs.inc-->
<!--METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->
<meta name="VI60_DefaultClientScript" content=VBScript>
<meta name="GENERATOR" content="Microsoft Visual Studio 6.0">
<title>Refresh Method Example (VBScript)</title>
font-family: 'Verdana','Arial','Helvetica',sans-serif;
background-color: #008080;
font-family: 'Verdana','Arial','Helvetica',sans-serif;
background-color: #800000;
font-family: 'Verdana','Arial','Helvetica',sans-serif;
background-color: #f7efde;
font-family: 'Verdana','Arial','Helvetica',sans-serif;
<h1>Refresh Method Example (VBScript)</h1>
<H2>RDS API Code Examples </H2>
<TD> <INPUT DATAFLD="FirstName" SIZE=15> </TD>
<TD> <INPUT DATAFLD="LastName" SIZE=15> </TD>
<TD> <INPUT DATAFLD="Title" SIZE=15> </TD>
<TD> <INPUT DATAFLD="HireDate" SIZE=15> </TD>
<!-- RDS.DataControl with no parameters set at design time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
Server: <Input Size=70 Name="txtServer" Value="http://<%=Request.ServerVariables("SERVER_NAME")%>"><BR>
Connect: <Input Size=70 Name="txtConnect" Value="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'"><BR>
SQL: <Input Size=70 Name="txtSQL" Value="Select * from Employees">
<TABLE BORDER=1 WIDTH="60%">
<TD COLSPAN=3 BGCOLOR=silver>
Choose if you want the Recordset brought back Synchronously on the
current calling thread or Asynchronously on another thread.
<Input Type="Radio" Name="optExecuteOptions" Checked OnClick="SetExO('adcExecSync')">
<Input Type="Radio" Name="optExecuteOptions" OnClick="SetExO('adcExecAsync')">
<TD COLSPAN=3 BGCOLOR=silver>
Fetch Up Front, Background Fetch with Blocking or Background Fetch
<Input Type="Radio" Name="optFetchOptions" OnClick="SetFO('adcFetchUpFront')">
<TD>Background w/ Blocking:<BR>
<Input Type="Radio" Name="optFetchOptions" Checked OnClick="SetFO('adcFetchBackground')">
<TD>Background w/o Blocking:<BR>
<Input Type="Radio" Name="optFetchOptions" OnClick="SetFO('adcFetchAsync')">
<INPUT TYPE=BUTTON NAME="Run" VALUE="Run"><BR>
<Script Language="VBScript">
EO = "adcExecSync" 'Default value
FO = "adcFetchBackground" 'Default value
' Set parameters of RDS.DataControl at Run Time
RDC.Server = txtServer.Value
RDC.Connect = txtConnect.Value
If EO = "adcExecSync" Then 'Determine which ExecuteOption chosen
RDC.ExecuteOptions = adcExecSync
MsgBox "Recordset brought in on current calling thread Syncronously"
RDC.ExecuteOptions = adcExecAsync
MsgBox "Recordset brought in on another thread Asyncronously"
If FO = "adcFetchBackground" Then 'Determine ‘which FetchOption chosen
RDC.FetchOptions = adcFetchBackground
MsgBox "Control goes back to user after first batch of records returned"
ElseIf FO = " adcFetchUpFront" Then
RDC.FetchOptions = adcFetchUpFront
MsgBox "All records returned before control goes back to user"
RDC.FetchOptions = adcFetchAsync
MsgBox "Control goes back to user immediately"
See Also
DataControl Object (RDS) | ExecuteOptions Property (RDS) | FetchOptions Property (RDS) | Recordset Object | Refresh Method