ApplyUpdates and Reconciliation of errors
Posted: Wed 19 Apr 2006 08:47
Hi there,
I am trying to implement an update reconciliation method. The idea is that if two clients access the same data at the same time, one edits the data and applies the update and the other one also edits the data and applies his updates, an OnReconcileError event is triggered pointing out to the second client that the data on the database is not consistent anymore with what he had initially.
Thus, supposing we have a simple "Customer" table with the following fields:
- Id (Integer)
- Name (VarChar 50)
and supposing we have the following components on the form:
- TMyConnection
- TMyTable
- TDataSetProvider (with the dataset set to the TMyTable component)
- TClientDataSet (with the provider set to the TDataSetProvider)
- TDataSource (with the dataset set to the TClientDataSet)
and that furthermore, the TMyTable field "Id" has the following ProviderFLags set to true:
- pfInUpdate, pfInWhere, pfInKey
and the TClientDataSet has an OnReconcileError event handling an OnReconcileError dialog (provided in the Borland sources),
and supposing now that 2 instances of the program are running at the same time, then applying the update on the first one and setting different values on the second one and applying the updates should raise the OnReconcileError dialog, pointing out to the 2nd user that the data has been modified on the database since he/she started editing.
All that works up to a certain point: It seems that the CurValue of the ClientDataSet is not returned thus rendering impossible the resolution of the conflict. I.e. the OnReconcileError dialog only shows the Modified Value and the Original Value but not the conflicting (i.e. current) value.
If one uses a different database, say the DBDEMOS provided by Borland with say an ADOConnection and an ADOQuery, it works fine.
Has anybody got any idea why it does not work with the MyDAC components? Has anyone managed such a procedure?
Any help to resolve that matter would be greatly appreciated.
Thanks
David
________
NEW JERSEY MARIJUANA DISPENSARY
I am trying to implement an update reconciliation method. The idea is that if two clients access the same data at the same time, one edits the data and applies the update and the other one also edits the data and applies his updates, an OnReconcileError event is triggered pointing out to the second client that the data on the database is not consistent anymore with what he had initially.
Thus, supposing we have a simple "Customer" table with the following fields:
- Id (Integer)
- Name (VarChar 50)
and supposing we have the following components on the form:
- TMyConnection
- TMyTable
- TDataSetProvider (with the dataset set to the TMyTable component)
- TClientDataSet (with the provider set to the TDataSetProvider)
- TDataSource (with the dataset set to the TClientDataSet)
and that furthermore, the TMyTable field "Id" has the following ProviderFLags set to true:
- pfInUpdate, pfInWhere, pfInKey
and the TClientDataSet has an OnReconcileError event handling an OnReconcileError dialog (provided in the Borland sources),
and supposing now that 2 instances of the program are running at the same time, then applying the update on the first one and setting different values on the second one and applying the updates should raise the OnReconcileError dialog, pointing out to the 2nd user that the data has been modified on the database since he/she started editing.
All that works up to a certain point: It seems that the CurValue of the ClientDataSet is not returned thus rendering impossible the resolution of the conflict. I.e. the OnReconcileError dialog only shows the Modified Value and the Original Value but not the conflicting (i.e. current) value.
If one uses a different database, say the DBDEMOS provided by Borland with say an ADOConnection and an ADOQuery, it works fine.
Has anybody got any idea why it does not work with the MyDAC components? Has anyone managed such a procedure?
Any help to resolve that matter would be greatly appreciated.
Thanks
David
________
NEW JERSEY MARIJUANA DISPENSARY