Handling update errors in multiple records in the TClientDataset's ReconcileError method

Posted by Fabio Gomes on Stack Overflow See other posts from Stack Overflow or by Fabio Gomes
Published on 2010-05-12T17:50:17Z Indexed on 2010/05/13 12:44 UTC
Read the original article Hit count: 433

I'm trying to use the ReconcileError event to allow the user to correct the data after an update error which occurred in a specific record among others.

Example:

I have a dataset with one field and 3 records, this field have a unique constraint on the database, then I change one value to conflict when it reaches the database, then I call ApplyUpdates on the Dataset.

This will generate an error (violation of unique constraint) in the provider and abort the applyupdates process, returning raAbort in the Action var of the ReconcileError method.

In the ReconcileError method I tryied to use:

Action := HandleReconcileError(aDataSet, UpdateKind, E); 

** EDIT **

After debugging and dumping the DataSet records which were returned from the server, I noticed that there are 2 records in this Dataset, the first is the Old record and the second have all the changes I made to the first record.

I'm a bit confused, will I always get this DataSet with 2 records? I thought that it should have only one record with the Old/New values.

Thanks.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about tclientdataset