|
-
Nov 4th, 2002, 06:14 AM
#1
Thread Starter
Fanatic Member
Transaction state
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.
-
Nov 4th, 2002, 06:35 AM
#2
Fanatic Member
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.
-
Nov 4th, 2002, 07:00 AM
#3
Thread Starter
Fanatic Member
Thanks tr0n,
I am actually using a dataEnvironment object, rather than a variable connection.
Its certainly put me on the right track.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|