Step 2: Invoke the Server Program (RDS Tutorial)

   

You are Here...

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, and 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 way 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 command text, which is used to specify the rows to be returned from the data source.

This tutorial uses the RDSServer.DataFactory 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