Step 5: DataControl is made usable (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

The returned Recordset object is available for use. You can examine, navigate, or edit it as you would any other recordset. Also note that up until this point it was sufficient to use an RDSServer.DataFactory object proxy to obtain the data. But now it is more convenient to use the RDS.DataControl to work with the data.

For example, if you are displaying a Web page in Microsoft Internet Explorer, you might want to display the Recordset object data in a visual control. Visual controls cannot access a Recordset object directly. However, they can access (that is, bind to) the Recordset object through an RDS.DataControl. The RDS.DataControl becomes usable by a visual control when its SourceRecordset property is set to the Recordset object.

(The visual control object must have its DATASRC parameter set to the RDS.DataControl; and its DATAFLD property set to a Recordset object field (column).)

In our tutorial, we'll set the SourceRecordset property.

Sub RDSTutorial4()
Dim DS as New RDS.DataSpace
Dim RS as New ADODB.Recordset    'Optionally, ADOR.Recordset
Dim DC as New RDS.DataControl
Dim DF as Object
Set DF = DS.CreateObject("RDSServer.DataFactory", "http://yourServer")
Set RS = DF.Query "DSN=pubs", "SELECT * FROM authors"
DC.SourceRecordset = RS            'Visual controls can now bind to DC.
...