FireDAC.Comp.Client.TFDRdbmsDataSet.OnError

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnError: TFDErrorEvent read GetOnError write SetOnError;

C++

__property Firedac::Stan::Error::TFDErrorEvent OnError = {read=GetOnError, write=SetOnError};

Properties

Type Visibility Source Unit Parent
event public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDRdbmsDataSet

Description

An event that fires when an error happens while the dataset is communicating with a DBMS.

The OnError event fires when the dataset executes one of the following operations and an error happens:

  • Prepare. The dataset is preparing the DBMS command text for execution.
  • Open. The dataset is executing the DBMS command to open the cursor.
  • Execute, ExecSQL, ExecProc. The dataset is executing the DBMS command text.
  • Navigation methods. The dataset is fetching rows from the cursor.

The event handler of OnError receives the following parameters:

You can handle OnError to analyze and modify the exception object. You can even create a new exception object and assign it to AException; if you do so, you must free the original exception object.

If AException is an instance of EFDDBArrayExecuteError, then it is a case of Array DML error handling.

To centralize error handling, you may consider using TFDCustomConnection.OnError.

See Also

Samples