Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi FireDac和中止前post,以及system.abort_Delphi_Exception_Firedac - Fatal编程技术网

Delphi FireDac和中止前post,以及system.abort

Delphi FireDac和中止前post,以及system.abort,delphi,exception,firedac,Delphi,Exception,Firedac,在continue to中,当使用FireDac并调用BeforePost事件到调用Abort的函数时,会导致整个系统中止,从而中断围绕该中止运行的循环 while not fdOtherQuery.eof do begin fdQuery.insert; fdquery.fields[0].asstring := fdOtherQuery.fields[0].asstring; fdquery.post; fdOtherQuery.next; end; 邮寄前: procedur

在continue to中,当使用FireDac并调用BeforePost事件到调用Abort的函数时,会导致整个系统中止,从而中断围绕该中止运行的循环

while not fdOtherQuery.eof do begin
  fdQuery.insert;
  fdquery.fields[0].asstring := fdOtherQuery.fields[0].asstring;
  fdquery.post;
fdOtherQuery.next;
end;
邮寄前:

procedure TForm1.AzureDayarKriaAdditionsBeforePost(DataSet: TDataSet);
begin
  calculcation;  
end;

procedure calculaction;
begin
  if fdQuery.fields[0].asstring = 0 then abort;
end;
如果调用计算中的中止,则

而不是fdOtherQuery.eof do begin


也被停止

中止会引发一个静默异常,可以通过try。。。除了

while not fdOtherQuery.eof do begin
  fdQuery.insert;
  fdquery.fields[0].asstring := fdOtherQuery.fields[0].asstring;
  try
    fdquery.post;
  except
    on E: EAbort do
    begin
      // log the error (when needed)
    end;
  end;   
  fdOtherQuery.next;
end;