Rollback Transaction
Posted: Sun 01 Jan 2006 03:32
I have a problem when I attempt rollback transaction using tMyTable, follows code in delphi:
con.StartTransaction;
try
qConsulta.First;
while not qConsulta.Eof do begin
//My commands
end;
con.commit
except
con.rollback
end;
Well, if I call rollback thought a button, it works perfect, but if I close form it commit transaction...When I use tMycommand work perfect like code bellow:
cmd.AutoCommit:=False;
cmd.SQL.Text:='start transaction';
cmd.Execute();
Did you note that I setup explicit autocommit:=false?? How can I do it using tMytable??
con.StartTransaction;
try
qConsulta.First;
while not qConsulta.Eof do begin
//My commands
end;
con.commit
except
con.rollback
end;
Well, if I call rollback thought a button, it works perfect, but if I close form it commit transaction...When I use tMycommand work perfect like code bellow:
cmd.AutoCommit:=False;
cmd.SQL.Text:='start transaction';
cmd.Execute();
Did you note that I setup explicit autocommit:=false?? How can I do it using tMytable??