Indicating the Type of Update that Generated an Error
From InterBase
Go Up to Handling Cached Update Errors
The OnUpdateRecord
event receives the parameter UpdateKind
, which is of type TUpdateKind
. It describes the type of update that generated the error. Unless your error handler takes special actions based on the type of update being carried out, your code probably will not make use of this parameter.
The following table lists possible values for UpdateKind:
Value | Meaning |
---|---|
|
Editing an existing record caused an error |
|
Inserting a new record caused an error |
|
Deleting an existing record caused an error |
The example below shows the decision construct to perform different operations based on the value of the UpdateKind
parameter.
procedure TForm1.DataSetUpdateError(DataSet: TDataSet; E: EDatabaseError; UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction); begin case UpdateKind of ukModify: begin { handle error due to applying record modification update } end; ukInsert: begin { handle error due to applying record insertion update } end; ukDelete: begin { handle error due to applying record deletion update } end; end; end;