Hi,
Is it possible to find the state of a transaction, whether it is open or not.
In my code the BeginTrans is in conditional statements, I don't want my error code to execute the RollBackTrans if the BeginTrans has not been executed.
Thanks all.
Printable View
Hi,
Is it possible to find the state of a transaction, whether it is open or not.
In my code the BeginTrans is in conditional statements, I don't want my error code to execute the RollBackTrans if the BeginTrans has not been executed.
Thanks all.
you could try something like this:
VB Code:
Dim WithEvents cn As ADODB.Connection Dim bTransactionOpen As Boolean Private Sub cn_BeginTransComplete(ByVal TransactionLevel As Long, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection) bTransactionOpen = True End Sub Private Sub cn_CommitTransComplete(ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection) bTransactionOpen = False End Sub Private Sub cn_RollbackTransComplete(ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection) bTransactionOpen = False End Sub
and then just test the boolean variable to see if it's open or not. :)
Thanks tr0n,
I am actually using a dataEnvironment object, rather than a variable connection.
Its certainly put me on the right track.