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

Recordset and SourceRecordset Properties Example

The following example shows how to set the necessary parameters of RDSServer.DataFactory default business object 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 ADCapi4.asp. ASP script will identify your server.

<Center><H2>API Code Examples ADC 1.5</H2>
<HR>
<H3>Using SourceRecordset and Recordset with RDSServer.DataFactory</H3>
<!-- RDS.DataSpace ID ADS1 -->
<OBJECT ID="ADS1" WIDTH=1 HEIGHT=1
CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36">
</OBJECT>

<!-- RDS.DataControl with parameters set at run time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
	ID=ADC>
</OBJECT>

<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="RDSServer.DataFactory Run Time">
</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
<BR>Try dsn=pubs;uid=sa;pwd=; and Select * From Authors</H4>
</Center>
<Script Language="VBScript">
<!--
Dim ADF
Dim strServer
strServer = "http://<%=Request.ServerVariables("SERVER_NAME")%>"

Sub Run_OnClick()
	Dim objADORs			' Create RDSServer.DataFactory Object
Set ADF = ADS1.CreateObject("RDSServer.DataFactory", strServer)					' Get Recordset
Set objADORs = ADF.Query(txtConnect.Value,txtSQL.Value)

' Set parameters of RDS.DataControl at Run Time
	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.