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.
procedure TForm1.CDS1ReconcileError(
DataSet: TCustomClientDataSet; E: EReconcileError; UpdateKind: TUpdateKind;
var Action: TReconcileAction);
begin
Action:=HandleReconcileError(Dataset, UpdateKind, E);
end;
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.
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]
Next: Information in Data Packets >>
More Delphi-Kylix Articles
More By Danish Ahmed