Transaction - how many ADOQuery required?



Hi. Consider the following Transaction. Can I use only one ADOQuery (i.e.
ADOQuery1) for all the three "INSERT INTO" statements?
(Delphi 7)

// start the transaction on the connection
ADOConnection1.BeginTrans;
try
with ADOQuery1 do
begin
//INSERT INTO statement to table1
ExecSQL;
end;
with ADOQquery2 do
begin

//INSERT INTO statement to table1
ExecSQL;
end;
with ADOQquery3 do
begin

//INSERT INTO statement to table2
ExecSQL;
end;
ADOConnection1.CommitTrans;
except
On E:Exception do
begin
ADOConnection1.RollbackTrans;
end;

end;//try


.



Relevant Pages

  • Weird ADO transaction problems
    ... explicit transaction handling then all is OK but I need transaction support. ... I need to perform many actions with multiple ADO datasets within the ... "Transaction cannot have multiple recordsets with this cursor type. ... ADOQuery1: TADOQuery; ...
    (borland.public.delphi.database.ado)
  • Transaction - how many ADOQuery required?
    ... Consider the following Transaction. ... ADOQuery1) for all the three "INSERT INTO" statements? ... //INSERT INTO statement to table1 ... with ADOQquery2 do ...
    (borland.public.delphi.database.ado)