Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is ADO Connection object in transaction?

Status
Not open for further replies.

BrianB

Programmer
Oct 2, 2000
186
US
Hi folks,

When I build complex databases, I usually use a global connection object and leave it open. While in theory every time I begin a transaction, I also commit it or roll it back, errors happen. I want to test if the connection is in the midst of a transaction without rolling it back or committing it. There doesn't seem to be any kind of "is in transaction" property. Any ideas?

Thanks in advance.

-Brian
 
Maybe a bit simple, but use a boolean to store if the transaction is been opened

i.e.
public mblnIsTransactionOpen as boolean

if mblnIsTransactionOpen then
'cant set transaction error message as transaction
'already opened
else
dbConn.BeginTrans 'begin transaction
mblnIsTransactionOpen = true
end if

dbconn.rollbacktrans
mblnIsTransactionOpen = false

etc.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top