Microsoft Remote Data ServiceMicrosoft Remote Data Service*
*Contents  *Index  *Topic Contents

RDS.DataControl Object Example

The following code shows how to set the RDS.DataControl parameters at design time and bind it to a data aware control using an ODBC data source called ADCDemo. If you followed directions, ADCDemo is installed on your server as a SQL Server ODBC data source. Cut and paste this code between the <Body></Body> tags in a normal HTML document and name it ADCapi1.asp. ASP script will identify your server.

<Center><H2>API Code Examples RDS 1.5</H2>
<HR><BR>
<H3>Remote Data Service</H3>
<Object CLASSID="clsid:AC05DC80-7DF1-11d0-839E-00A024A94B3A"
	CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/MSADC/Samples/Sheridan.cab"
	ID=GRID1 
		datasrc=#ADC 
		HEIGHT=125 
		WIDTH=495>
	<PARAM NAME="AllowAddNew"   VALUE="TRUE">
	<PARAM NAME="AllowDelete"   VALUE="TRUE">
	<PARAM NAME="AllowUpdate"   VALUE="TRUE">
</OBJECT>
<!-- Remote Data Service with Parameters set at Design Time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
	ID=ADC>
	<PARAM NAME="SQL" VALUE="Select * from Employee for browse">
	<PARAM NAME="SERVER" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">
	<PARAM NAME="CONNECT" VALUE="dsn=ADCDemo;UID=ADCDemo;PWD=ADCDemo;">
</OBJECT><BR><HR></Center>

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></Body> tags in a normal HTML document and name it ADCapi2.asp. ASP script will identify your server.

<Center><H2>API Code Examples RDS 1.5</H2>
<HR><BR>
<H3>Remote Data Service Run Time</H3>
<Object CLASSID="clsid:AC05DC80-7DF1-11d0-839E-00A024A94B3A"
	CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/MSADC/Samples/Sheridan.cab"
	ID=GRID1 
		datasrc=#ADC
		HEIGHT=125 
		WIDTH=495>
	<PARAM NAME="AllowAddNew" VALUE="TRUE">
	<PARAM NAME="AllowDelete" VALUE="TRUE">
	<PARAM NAME="AllowUpdate" VALUE="TRUE">
	<PARAM NAME="Caption" VALUE="Remote Data Service Run Time">
</OBJECT>

<!-- RDS.DataControl with no parameters set at design time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
	ID=ADC>
	</OBJECT>
<HR>
<Input Size=70 Name="txtServer" Value="http://<%=Request.ServerVariables("SERVER_NAME")%>"><BR>
<Input Size=70 Name="txtConnect" Value="dsn=ADCDemo;UID=ADCDemo;PWD=ADCDemo;">
<BR>
<Input Size=70 Name="txtSQL" Value="Select * from Employee">
<HR>
<INPUT TYPE=BUTTON NAME="Run" VALUE="Run"><BR>
<H4>Fill Grid with these values or change them to see data from another ODBC data source on your server</H4>
</Center>
<Script Language="VBScript">
<!--
' Set parameters of RDS.DataControl at Run Time
Sub Run_OnClick
	ADC.Server = txtServer.Value
	ADC.SQL = txtSQL.Value
	ADC.Connect = txtConnect.Value
	ADC.Refresh
End Sub
-->
</Script>

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.