Subject | Re: [IBO] Questions about Using IB_Transaction |
---|---|
Author | Jason Wharton |
Post date | 2000-12-04T17:07:44Z |
Take a close look at the transaction and connection components the dataset
is referencing.
It may be pointing to a connection that the transaction does not have
included in its list of connections.
Your code should look something like this:
tr.IB_Connection := cn;
tr.IB_Connection1 := cn1;
tr.StartTransaction;
try
<do your stuff here>
tr.Commit;
except
tr.Rollback;
raise;
end;
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
is referencing.
It may be pointing to a connection that the transaction does not have
included in its list of connections.
Your code should look something like this:
tr.IB_Connection := cn;
tr.IB_Connection1 := cn1;
tr.StartTransaction;
try
<do your stuff here>
tr.Commit;
except
tr.Rollback;
raise;
end;
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "Joel Gauvreau" <joel.gauvreau@...>
To: <IBObjects@egroups.com>
Sent: Monday, December 04, 2000 8:29 AM
Subject: [IBO] Questions about Using IB_Transaction
Hi,
I want to execute many different SQL statement within the same
Transaction and be able to rollback everything or commit everything..
The First Statements works fine, but the second I get an Error "Invalid
Transaction Handle (expecting explicit Transaction start)".
Is it wrong to use the same transaction for to separate connection to the
same database?
Is there some other way to achieve this?
example :
Var
Con1 : TIB_Connection;
Con2 : TIB_Connection;
Dts1 : TIB_Dataset;
Dts2 : TIB_Dataset;
Tr1 : TIB_Transaction;`
begin
...
Dts1.Ib_Connection := Con1;
dts1.Ib_Transaction := Tr1;
Dts1.SQL.Text := 'select * from table1';
Dts1.Open;
Showmessage(Dts1.FieldByname('Field1').asString);
Dts1.close;
dts2.ib_Connection := Con2;
Dts2.ib_Transaction := Tr1;
Dts2.Sql.text := 'update Table1 set field1="123abc";';
Dts2.Open; <-- I get the error here.
Dts2.Close;
Tr1.Commit;
end;
Any help would be greatly appreciated!
Thanks
Joël Gauvreau.
Programmer - UQAT