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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetAbort not causing a rollback

Status
Not open for further replies.

Hexonx

Programmer
Jan 10, 2001
102
US
I am using transacted ASP pages and found a curious issue.

If I call SetComplete then SetAbort, the transaction aborts (indicated by OnTransactionAbort firing).

But if I call SetAbort then SetComplete, the transaction still completes (indicated by OnTransactionCommit firing).

Don't transactions require unanimous committal? A single SetAbort should cause transaction abort, no matter how many times SetComplete is called. It's behaving like a "last one in wins" situation.

Any ideas?
 
Are you adding <%@ TRANSACTION=Required> on each page?

///edox
..
 
I understand what is happening now. Calling SetAbort and SetComplete during a method's execution is taken as a tentative vote. The vote is not actually cast until the method returns. This means that there is a &quot;last one in wins&quot; condition while the method is executing.

To handle this, I created a SetTransAbort(blnAborted) method in my page to set a member flag. If the flag is ever set to True, it cannot be set to False. At the conclusion of the page, I check the flag and abort as necessary. This makes it easy to determine anywhere in the page if the transaction has ever been voted to abort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top