Connect Property Example (VBScript)
This code shows how to set the Connect property at design time:
<OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="ADC1">
.
<PARAM NAME="SQL" VALUE="Select * from Sales">
<PARAM NAME="CONNECT" VALUE="Provider=SQLOLEDB;User Id=sa;Password=;Initial Catalog=Pubs">
<PARAM NAME="Server" VALUE="http://MyWebServer">
.
</OBJECT>
The following example shows how to set the Connect property at run time in VBScript code.
To test this example, cut and paste this code between the <Body></Body> tags in a normal HTML document and name it adcapi3.asp. ASP script will identify your server.
<H2>RDS API Code Examples </H2>
<HR>
<H3>Set Connect Property at Run Time</H3>
<!-- RDS.DataControl with no parameters set at design time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=RDS HEIGHT=1 WIDTH=1>
</OBJECT>
<TABLE DATASRC=#RDS>
<TBODY>
<TR>
<TD><SPAN DATAFLD="FirstName"></SPAN></TD>
<TD><SPAN DATAFLD="LastName"></SPAN></TD>
</TR>
</TBODY>
</TABLE>
SERVER: <Input Size=70 Name="txtServer" Value="http://<%=Request.ServerVariables("SERVER_NAME")%>"><BR>
CONNECT: <Input Size=70 Name="txtConnect"><BR>
SQL: <Input Size=70 Name="txtSQL" Value="Select * from Employee">
<BR>
<INPUT TYPE=BUTTON NAME="Run" VALUE="Run">
<BR>
To Fill Grid enter Connect String in middle text box, try<BR>
<B>Provider=SQLOLEDB;User Id=rdsdemo;Password=rdsdemo;Initial Catalog=AddrBookDB</B>
<Script Language="VBScript">
<!--
' Set parameters of RDS.DataControl at Run Time
Sub Run_OnClick
RDS.Server = txtServer.Value
RDS.SQL = txtSQL.Value
RDS.Connect = txtConnect.Value
RDS.Refresh
End Sub
-->
</Script>