|
-
December 22nd, 2003, 03:47 PM
#1
Transaction
Hello,
I am using the connection object to run action queries. Is there a property or method that could tell whether the connection has a transaction open or not?
Thank You, Hisham
-
December 23rd, 2003, 06:17 PM
#2
I would imagine that whatever connection object you're using woudl have a property telling you the status of the connection. If not, you coudl try polling the existance of the connection object itself as a way to derive its status. Good luck.
-
December 23rd, 2003, 07:33 PM
#3
If you're using sql server, you could write a proc that will return @@Trancount - if its not zero, then there is a transaction in progress, or waiting to be committed/rolled back
Be nice to Harley riders...
-
December 23rd, 2003, 11:13 PM
#4
Try this...
Hi,
Code:
if (adoConnnection.State = adStateOpen) then
' connection open for transaction
else
' connection closed
end if
__________________
- Buddhi from Sri Lanka -
- Paradise of Sinhalese/Buddhists -
-
January 6th, 2004, 05:13 AM
#5
You could try this too:
--------------------------------------------------------------
Dim blnOpen As Boolean
Dim cnn As New ADODB.Connection
'you must open the connection
cnn.BeginTrans
blnOpen = True
'code
cnn.CommitTrans
blnOpen = False
--------------------------------------------------------------
You can use then blnOpen to find out the state of the connection.
-
January 6th, 2004, 04:43 PM
#6
I think everyone else has missed the point - he is trying to determine whether a connection has a transaction that is currently open, not whether the connection is open or not.
The only way to do that, is to call @@TranCount (in sql server), and whatever the equivalent is in other databases.
If the connection is closed, then there can be no transactions outstanding, however if the connection is open, there may or may not be outstanding transactions, as the connection will not close if there are outstanding transactions, hence the question.
Be nice to Harley riders...
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
|