Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Transaction events not firing

Author  Topic 

filf
Yak Posting Veteran

67 Posts

Posted - 2001-06-20 : 06:57:32
I have a problem whereby I am trying to wrap an update in a transaction, but my onTransactionCommit and onTransactionAbort events are not firing, even though the transaction is working.

I have the following statement at the top of my page:
@TRANSACTION = supported
because objConn is a universal dsn db connection used by all pages in the site, and in many instances it is called by different pages in the same frameset. Is this my problem. If I change this statement to REQUIRED or REQUIRED_NEW which is what I think I possibly need I am getting unspecified errors in pages lower down the frameset when they try to make a second call to the same db connection.

Here are updates wrapped in a trans:
objConn.BeginTrans
sqlString = sqlStatement 1
objCmd.CommandText = sqlString
objCmd.CommandType = adCmdText
Set objCmd.ActiveConnection = objConn
objCmd.Execute

sqlString = sqlStatement 2
objCmd.CommandText = sqlString
objCmd.CommandType = adCmdText
Set objCmd.ActiveConnection = objConn
objCmd.Execute

objConn.CommitTrans

My events are as follows:
SUB objConn_OnTransactionCommit()
Response.write("Operation was successful")
end sub

SUB objConn_OnTransactionAbort()
objConn.RollbackTrans
Response.write("An error has occurred please Press F5 and then Try again.")
end sub

I am a bit of a newbie to this. I also cannot register any vb compenents on the host server so I am limited to only what I can do from an asp page. I am sure the clue is in the transaction statement I am placing in the top of the page, any ideas which improve how I am doing this would be greatly appreciated.



   

- Advertisement -