Handling Cached Update Errors

From InterBase

Go Up to Working with Cached Updates


Because there is a delay between the time a record is first cached and the time cached updates are applied, there is a possibility that another application may change the record in a database before your application applies its updates. Even if there is no conflict between user updates, errors can occur when a record’s update is applied.

A dataset component’s OnUpdateError event enables you to catch and respond to errors. You should create a handler for this event if you use cached updates. If you do not, and an error occurs, the entire update operation fails.

Important:
Do not call any dataset methods that change the current record (such as Next and Prior) in an OnUpdateError event handler. Doing so causes the event handler to enter an endless loop.

Here is the skeleton code for an OnUpdateError event handler:

procedure TForm1.DataSetUpdateError(DataSet: TDataSet; E: EDatabaseError;
  UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
  { ... perform update error handling here ... }
end;

The following sections describe specific aspects of error handling using an OnUpdateError handler, and how the event’s parameters are used.

Topics

Advance To: