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"
...