SDAC 4.70
Delphi 2006
I am trying to follow the advice given for my previous issue in this forum (Simple multi-user problem locks/transactions)
I have the following code:
txnNextCB.AddConnection(qryNextCB.Connection);
txnNextCB.StartTransaction;
qryNextCB.open;
where txnNextCB is a TMStransaction and qryNextCB is a TMSquery.
txnNextCB has been put on the form with all the defaults apart from its name and this is the first time it is referenced - no other connections have been added.
When I run the code, I get:
"A connection with the transaction manager was lost"
If I comment out the code referring to the transaction
// txnNextCB.AddConnection(qryNextCB.Connection);
// txnNextCB.StartTransaction;
qryNextCB.open;
the query runs okay indicating that qryNextCB.Connection is connected and works.
What am I doing wrong?
"A connection with the transaction manager was lost"
-
Jeff Gallant
- Posts: 5
- Joined: Wed 22 Oct 2008 16:08
- Location: London
I can not reproduce the problem.
Please check if the following code works:
Please check if the following code works:
Code: Select all
qryNextCB.Connection.StartTransaction;
qryNextCB.open;-
Jeff Gallant
- Posts: 5
- Joined: Wed 22 Oct 2008 16:08
- Location: London
"A connection with the transaction manager was lost"
Thanks Dimon, that got me through that point but now my code is:
txnNextCB.AddConnection(qryNextCB.Connection);
qryNextCB.Connection.StartTransaction;
qryNextCB.open;
qryNextCB.Lock(ltExclusive);
some other code that uses FieldByName to capture data from the selected record
qryUpdateCB.Connection:=qryNextCB.Connection;
qryUpdateCB.execute; // Updates record selected by qryNextCB
qryNextCB.Connection.Commit;
qryNextCB.UnLock;
However, when it executes the unlock I get
“the ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION”
I've obviously still not got the hang of this.
What I am trying to do is prevent anyone else successfully selecting and locking this record until after the update is posted (the update changes the record so qryNextCB's where clause would no longer select it) so I cannot unlock the record until after the update is committed.
Assuming no-one responds today, may I wish you all a happy new year and hope that I can get this resolved early in 2009.
Best wishes
Jeff
txnNextCB.AddConnection(qryNextCB.Connection);
qryNextCB.Connection.StartTransaction;
qryNextCB.open;
qryNextCB.Lock(ltExclusive);
some other code that uses FieldByName to capture data from the selected record
qryUpdateCB.Connection:=qryNextCB.Connection;
qryUpdateCB.execute; // Updates record selected by qryNextCB
qryNextCB.Connection.Commit;
qryNextCB.UnLock;
However, when it executes the unlock I get
“the ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION”
I've obviously still not got the hang of this.
What I am trying to do is prevent anyone else successfully selecting and locking this record until after the update is posted (the update changes the record so qryNextCB's where clause would no longer select it) so I cannot unlock the record until after the update is committed.
Assuming no-one responds today, may I wish you all a happy new year and hope that I can get this resolved early in 2009.
Best wishes
Jeff