FireDAC.Comp.Client.TFDRdbmsDataSet.OnError
Delphi
property OnError: TFDErrorEvent read GetOnError write SetOnError;
C++
__property Firedac::Stan::Error::TFDErrorEvent OnError = {read=GetOnError, write=SetOnError};
Contents
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:
ASender
is the RDBMS dataset.AInitiator
is the object that raises the exception.AException
is the exception. It is usually an instance of EFDDBEngineException.
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
- FireDAC.Comp.Client.TFDCustomQuery.ExecSQL
- FireDAC.Comp.Client.TFDCustomStoredProc.ExecProc
- FireDAC.Comp.Client.TFDRdbmsDataSet.Prepare
- FireDAC.Stan.Error.EFDDBArrayExecuteError
- FireDAC.Stan.Error.EFDDBEngineException
- FireDAC.Comp.Client.TFDCustomConnection.OnError