Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Re: asp_components digest: February 02, 2001


Message #1 by ulateef@a... on Sat, 3 Feb 2001 09:48:00 +0500

Hi Everyone EveryWhere!



I'm using NT4 Worksattion and PWS. I'm using MTS also. Now the problem

which I'm not understanding is the code below.



<%@ TRANSACTION = REQUIRED %>



and I'm using



Sub OnTransactionCommit()

     blahblah

End Sub



Sub OnTransactionAbort()

     blahblah

End Sub



My component is not registered in the mts but still the MTS explorer is

showing Aboted and Commited transactions.



Whats the logic behind this.





Umair Latif







Message #2 by Imar Spaanjaars <Imar@S...> on Sat, 03 Feb 2001 15:39:08 +0100
It looks like you are using transactions in your ASP page as well. 

Transactions are not limited to just components, you can have transactional 

pages as well.

So you'll need to consider if this is really necessary (as using 

transactions creates some overhead). If you are just displaying data, there 

is no need for transactions. But if you do inserts or updates to the 

database that can leave the database in an unstable state if at least one 

update fails, then you'll need transactions. (Very short summary / reason 

on why to use MTS)



The code below first states that a transaction is required for the page. 

This will create a new transaction if it is not already participating in 

one. (This is not very likely since a transaction is only valid for one 

page, so there can't be an old transaction when you load the page. This 

means that for every time the page is executed, a new transaction will be 

started.)



If the code in your page completes without any error, SetComplete will be 

called after which OnTransactionCommit will be run. This sub can be used to 

display a confirmation message for example.

If errors occur, or SetAbort is called from your code, the transaction will 

be rolled back (un-done) and OnTransactionAbort is called. Here you could 

display a failure message.



Check out 

http://msdn.microsoft.com/library/default.asp?URL=/library/partbook/asp20/theaspobjectcontextobject.htm 

(and the articles before and after it in the TOC tree) for a short 

introduction to transactions in ASP.



HtH



Imar







At 09:48 AM 2/3/2001 +0500, you wrote:



>Hi Everyone EveryWhere!

>

>I'm using NT4 Worksattion and PWS. I'm using MTS also. Now the problem

>which I'm not understanding is the code below.

>

><%@ TRANSACTION = REQUIRED %>

>

>and I'm using

>

>Sub OnTransactionCommit()

>      blahblah

>End Sub

>

>Sub OnTransactionAbort()

>      blahblah

>End Sub

>

>My component is not registered in the mts but still the MTS explorer is

>showing Aboted and Commited transactions.

>

>Whats the logic behind this.

>

>

>Umair Latif



Message #3 by Vema Reddy <vemareddy7@y...> on Sat, 3 Feb 2001 02:41:53 -0800 (PST)



       Your ASP Page is runnig under the transaction 

       because you asked to do so at the begining of   

       the page



=====

Vema Reddy




  Return to Index