procedure TDM_SYS.PubP_BatchSaveStdData(MastTbl: TFDQuery);
var
n:Integer;
begin
try
if MastTbl.State in [dsedit,dsinsert] then MastTbl.Post;
MastTbl.ApplyUpdates(0); //通过DEBUG,可以定位错在这里
except
on e:Exception do begin
ShowErrorMsg(e.Message,AAbort);
end;
end;
end;
使用 TRY..Except 并不能捕获到 ApplyUpdates 的错误;
解决的方法,就是在 FDQuery 的 OnUpdateError 事件中加入代码:
raise AException;
然后才能被获取到