DataControl Object Example (VBScript)
In this article
The following code shows how to set the RDS.DataControl parameters at design time and bind them to a data-aware control. Cut and paste this code between the <Body> and </Body> tags in a normal HTML document and name it DataControlDesignVBS.asp . ASP script will identify your server.
<!-- BeginDataControlDesignVBS -->
<META name="VI60_DefaultClientScript" content=VBScript>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>RDS DataControl</title>
<%' local style sheet used for display%>
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;
<H2>RDS API Code Examples</H2>
<H3>Remote Data Service</H3>
<TD><SPAN DATAFLD="FirstName"></SPAN></TD>
<TD><SPAN DATAFLD="LastName"></SPAN></TD>
<!-- Remote Data Service with Parameters set at Design Time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
<PARAM NAME="SQL" VALUE="Select * from Employees for browse">
<PARAM NAME="SERVER" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">
<PARAM NAME="CONNECT" VALUE="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'">
<!-- EndDataControlDesignVBS -->
The following example shows how to set the necessary parameters of RDS.DataControl at run time. To test this example, cut and paste this code between the <Body> and </Body> tags in a normal HTML document and name it DataControlRuntimeVBS.asp . ASP script will identify your server.
<!-- BeginDataControlRuntimeVBS -->
<meta name="VI60_DefaultClientScript" content=VBScript>
<meta name="GENERATOR" content="Microsoft Visual Studio 6.0">
<title>Data Control Object Example (VBScript)</title>
<%' local style sheet used for display%>
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>Data Control Object Example (VBScript)</h1>
<H2>RDS API Code Examples</H2>
<H3>Remote Data Service Run Time</H3>
<TD><SPAN DATAFLD="au_lname"></SPAN></TD>
<TD><SPAN DATAFLD="au_fname"></SPAN></TD>
<% ' RDS.DataControl with no parameters set at design time %>
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID=RDS HEIGHT=1 WIDTH=1></OBJECT>
<Input Size="70" Name="txtServer" Value="http://<%=Request.ServerVariables("SERVER_NAME")%>"><BR>
<Input Size="100" Name="txtConnect" Value="Provider='sqloledb';Data Source=<%=Request.ServerVariables("SERVER_NAME")%>;Initial Catalog='Pubs';Integrated Security='SSPI';">
<Input Size="70" Name="txtSQL" Value="Select * from Authors">
<INPUT TYPE="BUTTON" NAME="Run" VALUE="Run"><BR>
<H4>Show grid with these values or change them to see data from another ODBC data source on your server</H4>
<Script Language="VBScript">
' Set parameters of RDS.DataControl at Run Time
RDS.Server = document.frmInput.txtServer.Value
RDS.Connect = document.frmInput.txtConnect.Value
RDS.SQL = document.frmInput.txtSQL.Value
<!-- EndDataControlRuntimeVBS -->
See Also
DataControl Object (RDS)