Client Dataset: Working with Data Packets and Applying Updates
This article is the fifth part of my series on the Client Dataset available in Delphi. It will focus on how to work with data packets by using the features of client dataset/dataset provider components.
Client Dataset: Working with Data Packets and Applying Updates - Reconciling Errors (Page 2 of 4 )
Reconciling Errors
When the HandleReconcileError method is called it brings up the Reconcile Error Dialog, displaying information on the record that could not be updated. It displays all three values of the record: the value held by the field before it was modified, the modified value, and the current value of the record on the server. The dialog also displays information pertaining to the update type, and the reason why the update failed is described in the error message panel. It also allows the user to edit the values of the record to be updated and choose the reconcile action type.
Dataset: A dataset containing modified records that could not be saved to the database server. You can get information and edit records using its methods and properties to correct the problem that makes posting to the database difficult.
E: The exception object representing the error; use this object to extract the error message or determine the cause of the error.
UpdateKind: The type of update that generated the error.
An UpdateKind can be:
ukInsert - Implying that the error occurred during an Insert statement or while inserting a new record.
ukDelete - Implying that the error occurred while deleting an existing record.
ukModify - Implying that the problem occurred while updating an existing record that was modified.
Action: This parameter allows you to specify what action is to be taken when the handler exits.
To skip the record, leaving it in the change log, specify the Action as rrSkip or raSkip
To abort the reconciliation operation, specify rrAbort or raAbort
If a record from the server has not been modified, it can be merged with the corresponding record on the server by specifying the Action as rrMerge or raMerge
The Reconcile Error dialog allows the user to provide a new value for the current record in the change log. Specify the Action as rrApply or raCorrect to replace the current value of the dataset with the user-specified value.
If you want to discard the changes you made to the change log in this OnReconcileError handler, pass Action as rrCancel
To update the current value of the record with the value in the server, use raRefresh as the value of the Action parameter. This option can be used only in the OnReconcileError event handler.
rrIgnore - Use if the event generated is OnUpdateError. It is intended for the case where the event handler applies the update back to the database server. The updated record is removed from the change log and merged into Data, as if the provider had applied the update. [Delphi help file]