主要错误信息属性:
1.EFDDBEngineException
- Errors -- TFDDBError对象集合.
- ErrorCount --错误的记录数
- Kind -- DBMS的错误集合.
- Message --错误消息.
2. TFDDBError属性:
- ErrorCode -- DBMS错误代码
- Kind -- DBMS的错误集合.
- Message --错误消息.
处理OnError过程:
procedure TForm1.FDConnection1Error(ASender: TObject; const AInitiator: IFDStanObject;
var AException: Exception);
var
oExc: EFDDBEngineException;
begin
if AException is EFDDBEngineException then begin
oExc := EFDDBEngineException(AException);
if oExc.Kind = ekRecordLocked then
oExc.Message := ‘Please, try the operation later. At moment, the record is busy‘
else if (oExc.Kind = ekUKViolated) and SameText(oExc[0].ObjName, ‘UniqueKey_Orders‘) then
oExc.Message := ‘Please, provide the unique order information. It seems, your order was already put‘;
end;
end;
FDConnection1.OnError := FDConnection1Error;
时间: 2024-10-05 07:15:21