ComponentOne True DataControl 8.0
Using TData in Distributed Applications (disconnected recordset support)

Building distributed applications, it is a common practice to use disconnected recordsets (Recordset.ActiveConnection = Nothing). A disconnected recordset is created on the server and marshaled (passed) to the client. When client updates must be saved in the database, the disconnected recordset is passed back to the server, re-connected to the database, and changes are saved in the database with Recordset.UpdateBatch. To use TData in a distributed application, you need to do the following:

Here update_procedure is a subroutine or an object method (it may be a business object) passing TData.SourceRecordset to the server for update. Write all the necessary code to update the database (on the server) in this procedure/method. If you already have pre-built classes for database update, use them here.

This is how it works: TData.Recordset.UpdateBatch sends users changes to TData.SourceRecordset (before this, TData.SourceRecordset remained unchanged), it does not save the changes in the database, because TData.ManualUpdate is set to True. Then modified SourceRecordset is sent to the server for update. After successful update, you need to reset the state of TData.SourceRecordset rows, to reflect the fact that there are no longer pending changes. This is done by TData.SourceRecordset.UpdateBatch. It does not perform any update (SourceRecordset is disconnected, so there is no database to update), it just resets the pending change flags. Depending on your application logic, you may consider refreshing TData with new data, fetched from the server, at this point, because data could change as a result of database update. But this is optional, necessary only if your application logic requires it.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback