AnyDAC
ContentsIndexHome
PreviousUpNext
TADStoredProc.OnExecuteError Event

The event is triggered when an error happens, while executing a Array DML query.

Group
Links
Parameters 
Description 
ASender 
The reference to dataset. 
ATimes 
The current Array DML size. It may be different from value of the Execute method ATimes parameter, if full operation is splitted into few more small (on Firebird, for example). 
AOffset 
The current Array DML offset. It may be different from value of the Execute method AOffset parameter, if there was skipped erroneous rows or full operation is splitted into few more small (on Firebird, for example). 
AError 
The original DBMS returned error. Check AError.Errors[i].RowIndex for the index of erroneous row in parameters array. 
AAction 
The action dataset should take after return from event handler. 

The OnExecuteError event is triggered, when the dataset failed to execute Array DML using Execute method and ATimes > 1. Using this event handler you can:

  • skip erroneous row of the parameters array;
  • change values in erroneous row of the parameters array;
  • stop full Array DML execution.

Note, OnExecuteError will be not called for the syntax errors or when ATimes = 1.

property OnExecuteError: TADExecuteErrorEvent;
procedure TForm1.ADQuery1ExecuteError(ASender: TObject; ATimes,
  AOffset: Integer; AError: EADDBEngineException; var AAction: TADErrorAction);
begin
  if AException.Errors[0].Kind = ekUKViolated then
    AAction := eaSkip
  else
    AAction := eaFail;
end;
What do you think about this topic? Send feedback!