Step 2: Invoke the Server Program (RDS Tutorial)

You are Here...

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

  2. Invoke the server program. Pass parameters to the server program that identify the data source and the command to issue.

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

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

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

  6. 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. We want to execute a query on the server.

2a) The most convenient way to perform this step is to use the RDS.DataControl. The RDS.DataControl combines the previous step of creating a proxy, and this step, of issuing the query. This is the default behavior of the RDS.DataControl.

Set the 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.

We won't use the RDS.DataControl for this tutorial, but this is how it would look if we did:

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

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

For this tutorial, we'll use the DataFactory Query method:

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