Step 6: Changes are Sent to the Server (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

If the Recordset object is edited, any changes (that is, rows that are added, changed, or deleted) can be sent back to the server.

6a) Let's assume for this case that we have only used the RDS.DataControl and a Recordset object is now associated with the RDS.DataControl. The SubmitChanges method updates the data source with any changes to the Recordset object if the Server and Connect properties are still set.

Sub RDSTutorial6A()
Dim DC as New RDS.DataControl
DC.Server = "http://yourServer"
DC.Connect = "DSN=pubs"
DC.SQL = "SELECT * FROM authors"
DC.Refresh
...                                    'Edit the Recordset
DC.SubmitChanges
...

6b) Alternatively, you could update the server with the RDSServer.DataFactory object, specifying a connection and a Recordset object.

Sub RDSTutorial6B()
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.
...                                    'Edit the Recordset
DF.SubmitChanges "DSN=pubs", RS

This is the end of the Tutorial.