MTS, ASP Pages and Transactions 
Author Message
 MTS, ASP Pages and Transactions

I have a COM DLL in which the classes have an "MTS Transaction Mode" of
"Requires Transactions".  These classes are called from ASP pages.  In a
particular ASP page, I make several *separate* calls to functions in the COM
DLL that inserts and/or updates records.  I understand that each of these
calls is treated as a separate transaction and will commit or rollback

Required %>" directive at the top of the ASP page, will all my separate COM
calls/transactions be treated as a single transaction?  For example, assume
my ASP page makes the following COM calls:

1) InsertRecord_1():  This function commits successfully
(Context.SetComplete is called in the COM function)
2) InsertRecord_2(): This COM function commits successfully
(Context.SetComplete is called in the COM function)
3) UpdateRecord_3(): This COM function commits successfully
(Context.SetComplete is called in the COM function)
4) InsertRecord_4(): This COM function aborts (Context.SetAbort is called in
the COM function)

Will the failing of InsertRecord_4() cause the first three
functions/transactions to rollback?

Thanks very much.

Randy



Mon, 01 Jul 2002 03:00:00 GMT  
 MTS, ASP Pages and Transactions
I would suggest redesigning your application so that it packages all the
information from ASP page into one COM call, and then COM function in turn
may call the same functions that you currently use. Only create classes
within the function using CreateInstance().
Such a solution should perform better and be more scalable, though requires
some work.
Good luck,
Gene


Quote:
> I have a COM DLL in which the classes have an "MTS Transaction Mode" of
> "Requires Transactions".  These classes are called from ASP pages.  In a
> particular ASP page, I make several *separate* calls to functions in the
COM
> DLL that inserts and/or updates records.  I understand that each of these
> calls is treated as a separate transaction and will commit or rollback

> Required %>" directive at the top of the ASP page, will all my separate
COM
> calls/transactions be treated as a single transaction?  For example,
assume
> my ASP page makes the following COM calls:

> 1) InsertRecord_1():  This function commits successfully
> (Context.SetComplete is called in the COM function)
> 2) InsertRecord_2(): This COM function commits successfully
> (Context.SetComplete is called in the COM function)
> 3) UpdateRecord_3(): This COM function commits successfully
> (Context.SetComplete is called in the COM function)
> 4) InsertRecord_4(): This COM function aborts (Context.SetAbort is called
in
> the COM function)

> Will the failing of InsertRecord_4() cause the first three
> functions/transactions to rollback?

> Thanks very much.

> Randy



Mon, 01 Jul 2002 03:00:00 GMT  
 MTS, ASP Pages and Transactions
Gene,

Thank you but that is not what I asked.  I certainly realize that I can use
one COM call.  But that would involve creating a function with over 40
parameters and would involve much more complexity than I have now and much
less maintainability.

Randy


Quote:
> I would suggest redesigning your application so that it packages all the
> information from ASP page into one COM call, and then COM function in turn
> may call the same functions that you currently use. Only create classes
> within the function using CreateInstance().
> Such a solution should perform better and be more scalable, though
requires
> some work.
> Good luck,
> Gene



> > I have a COM DLL in which the classes have an "MTS Transaction Mode" of
> > "Requires Transactions".  These classes are called from ASP pages.  In a
> > particular ASP page, I make several *separate* calls to functions in the
> COM
> > DLL that inserts and/or updates records.  I understand that each of
these
> > calls is treated as a separate transaction and will commit or rollback

> > Required %>" directive at the top of the ASP page, will all my separate
> COM
> > calls/transactions be treated as a single transaction?  For example,
> assume
> > my ASP page makes the following COM calls:

> > 1) InsertRecord_1():  This function commits successfully
> > (Context.SetComplete is called in the COM function)
> > 2) InsertRecord_2(): This COM function commits successfully
> > (Context.SetComplete is called in the COM function)
> > 3) UpdateRecord_3(): This COM function commits successfully
> > (Context.SetComplete is called in the COM function)
> > 4) InsertRecord_4(): This COM function aborts (Context.SetAbort is
called
> in
> > the COM function)

> > Will the failing of InsertRecord_4() cause the first three
> > functions/transactions to rollback?

> > Thanks very much.

> > Randy



Mon, 01 Jul 2002 03:00:00 GMT  
 MTS, ASP Pages and Transactions

Quote:
> Will the failing of InsertRecord_4() cause the first three
> functions/transactions to rollback?

No, because when you call SetComplete or SetAbort the transaction is
committed or rolled back, and is done. Each call initiates a new

this behavior...

Brian A. Manlove
Magenic Technologies Int'l.



Mon, 01 Jul 2002 03:00:00 GMT  
 MTS, ASP Pages and Transactions
Brian,

This does not make any sense to me.  I'm getting exactly the behaviour you

directive cannot ensure this behaviour since it's ensured now by MTS.

Randy


Quote:
> > Will the failing of InsertRecord_4() cause the first three
> > functions/transactions to rollback?

> No, because when you call SetComplete or SetAbort the transaction is
> committed or rolled back, and is done. Each call initiates a new

> this behavior...

> Brian A. Manlove
> Magenic Technologies Int'l.



Tue, 02 Jul 2002 03:00:00 GMT  
 MTS, ASP Pages and Transactions
Randy,

I haven't done much ASP lately, so I had to do some re-reading...  I was
half correct.  This has a lot to do with another recent post regarding a
"last one called wins" scenario.

You can use and control a transaction and the ObjectContext from your ASP,
because the transactional directive gives you the ObjectContext in the ASP
and makes your ASP the "parent" or "root" of a transaction.  After calling
all of your methods, call ObjectContext.SetComplete/SetAbort in the ASP.
The reason the transaction committed is because in ASP (or a com+ object for
that matter) if you don't call SetComplete or SetAbort, the default is
SetComplete.

HTH,

Brian A. Manlove
Magenic Technologies Int'l.



Tue, 02 Jul 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. When to use MTS transactions and ADO Transactions

2. MTS - Identifying user name from ASP page

3. calling asp page from another asp page

4. How to use MTS Style Transactions in VB.Net

5. MTS - Microsoft Transaction Server

6. MTS Microsoft Transaction Server

7. Enlisting VBScript in an MTS/COM+ transaction

8. What is an MTS Transaction?

9. Migration MTS projects to 2000, Old References to Transaction Server Type Library

10. Access and MTS and Transactions

11. MTS Transactions Questions

12. Single transaction without MTS

 

 
Powered by phpBB® Forum Software