Step 2: Invoke the Server Program (RDS Tutorial)

Microsoft ActiveX Data Objects (ADO)

Step 2: Invoke the Server Program (RDS Tutorial)

You are Here...

  • Specify the program to be invoked on the server, and obtain a proxy.

  • Invoke the server program. Pass parameters to the server program that identifies the data source and the command to issue.

  • The server program obtains a Recordset object from the data source, typically by using ADO.

  • The server program returns the final Recordset object to the client application.

  • On the client, the Recordset object is optionally put into a form that can be easily used by visual controls.

  • Changes to the Recordset object are sent back to the server and used to update the data source.

Discussion

When you invoke a method on the client proxy, the actual program on the server executes the method. In this step, you'll execute a query on the server.

Part A   If you weren't using RDSServer.DataFactory in this tutorial, the most convenient way to perform this step would be to use the RDS.DataControl object. The RDS.DataControl combines the previous step of creating a proxy, with this step, issuing the query.

Set the RDS.DataControl object Server property to identify where the server program should be instantiated; the Connect property to specify the connect string to access the data source; and the SQL property to specify the query command text. Then issue the Refresh method to cause the server program to connect to the data source, retrieve rows specified by the query, and return a Recordset object to the client.

This tutorial doesn't use the RDS.DataControl, but this is how it would look if it did:

Sub RDSTutorial2A()
   Dim DC as New RDS.DataControl
   DC.Server = "http://yourServer"
   DC.Connect = "DSN=Pubs"
   DC.SQL = "SELECT * FROM Authors"
   DC.Refresh
...

Nor does the tutorial invoke RDS with ADO objects, but this is how it would look if it did:

Dim rs as New ADODB.Recordset
   rs.Open "SELECT * FROM Authors", "Provider=MS Remote;Data Source=Pubs;Remote Server=http://YourServer"

Part B   The general method of performing this step is to invoke the RDSServer.DataFactory object Query method. That method takes a connect string, which is used to connect to a data source, and a command text, which is used to specify the rows to be returned from the data source.

This tutorial uses the DataFactory object Query method:

Sub RDSTutorial2B()
   Dim DS as New RDS.DataSpace
   Dim DF
   Dim RS as ADODB.Recordset
   Set DF = DS.CreateObject("RDSServer.DataFactory", "http://yourServer")
   Set RS = DF.Query ("DSN=Pubs", "SELECT * FROM Authors")
...

Next   Step 3: Server Obtains a Recordset