我的代码是: ADOConnection.BeginTrans; try adoMain.UpdateBatch(); if IfDetail then adoDetail.UpdateBatch(); ADOConnection.CommitTrans; except on E: Exception do begin ADOConnection.RollbackTrans; if IfDetail then adoDetail.CancelBatch(); adoMain.CancelBatch(); raise Exception.Create(E.Message); end;
ADOConnection.BeginTrans;
try
adoMain.UpdateBatch();
if IfDetail then
adoDetail.UpdateBatch();
ADOConnection.CommitTrans;
except
on E: Exception do
begin
ADOConnection.RollbackTrans;
if IfDetail then
adoDetail.CancelBatch();
adoMain.CancelBatch();
raise Exception.Create(E.Message);
end;