This is a restatement of the RDS Tutorial, written in the Visual Basic, Scripting Edition.
This is the beginning of the Tutorial.
<!-- RDS.DataControl -->
<OBJECT
ID="DC1" CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E33">
</OBJECT>
<!-- RDS.DataSpace -->
<OBJECT
ID="DS1" WIDTH=1 HEIGHT=1
CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36">
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
Sub RDSTutorial()
Dim DF1 as Object
Step 1 - Specify a Server Program
VBScript can discover the name of the server it is running on by accessing the VBScript Request.ServerVariables method:
"http://<%=Request.ServerVariables("SERVER_NAME")%>"
However, for this tutorial, we will use the imaginary server, "yourServer".
Note Pay attention to the data type of ByRef arguments. VBScript does not let you specify the variable type, so you must always pass a Variant. When using HTTP, RDS will allow you to pass a Variant to a method that expects a non-Variant if you invoke it with the RDS.DataSpace object CreateObject method. When using DCOM or an in-process server, match the parameter types on the client and server sides or you will receive a "Type Mismatch" error.
Set DF1 = DS1.CreateObject("RDSServer.DataFactory", "http://yourServer")
Step 2a - Invoke the Server Program with RDS.DataControl
This example is merely a comment demonstrating that the default behavior of the DataControl is to perform the specified query.
<OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="DC1">
<PARAM NAME="SQL" VALUE="SELECT * FROM authors">
<PARAM NAME="Connect" VALUE="DSN=Pubs;">
<PARAM NAME="Server" VALUE="http://YourServer/">
</OBJECT>
...
<SCRIPT LANGUAGE="VBScript">
Sub RDSTutorial2A()
Dim RS as New ADODB.Recordset
RS = DC1.Refresh
...
Step 2b - Invoke the Server Program with RDSServer.DataFactory
Step 3 - Server Obtains a Recordset
Step 4 - Server Returns the Recordset
Set RS = DF1.Query("DSN=pubs", "SELECT * FROM authors")
Step 5 - DataControl is Made Usable by visual controls
' Assign the returned recordset to the DataControl.
DC1.SourceRecordset = RS
Step 6a - Changes are Sent to the Server with RDS.DataControl
This example is merely a comment demonstrating how the DataControl performs updates.
<OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="DC1">
<PARAM NAME="SQL" VALUE="SELECT * FROM authors">
<PARAM NAME="Connect" VALUE="DSN=Pubs;">
<PARAM NAME="Server" VALUE="http://YourServer/">
</OBJECT>
...
<SCRIPT LANGUAGE="VBScript">
Sub RDSTutorial6A()
Dim RS as New ADODB.Recordset
RS = DC1.Refresh
...
' Edit the Recordset object...
' The SERVER and CONNECT properties are already set.
DC1.SubmitChanges
Step 6b - Changes are Sent to the Server with RDSServer.DataFactory
DF.SubmitChanges "DSN=pubs", RS
End Sub
</SCRIPT>
</BODY>
</HTML>
This is the end of the Tutorial.