5.Firedac错误信息

Posted on 2015-02-24 13:17  墨者工作室  阅读(1025)  评论(0编辑  收藏  举报

主要错误信息属性:

1.EFDDBEngineException

2. TFDDBError属性:

处理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;

Copyright © 2024 墨者工作室
Powered by .NET 8.0 on Kubernetes