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

ObjectContext Vs Connection Object 1

Status
Not open for further replies.

Deadline

Programmer
Feb 28, 2001
367
US
Hi
Can you please tell me what is the difference between using
Code:
ObjectContext
and
Code:
Connection
object for transactions ?

I mean, what is the difference in using
Code:
cn.CommitTrans
and
Code:
ObjectContext.SetComplete
(or may be
Code:
cn.RollbackTrans
vs
Code:
ObjectContext.setAbort
)?

If I use Connection object to perform the transaction, will the events
Code:
OnTransactionCommit
and
Code:
OnTransactionAbort
fired ?

You'll be doing me one of greatest favours, if you can clarify this for me..

In advance,


Thanks!

RR


 
UPDATE:

Anyone knows answer to the above question ? Thank you...
RR

 
The two methods appear to be very similar from a functional perspective. If you've ever built a component that ran in COM+ Services (MTS), you'll remember the ObjectContext there. Essentially, a COM+ transaction boundary envelops your page (and other pages called with Server.Transfer or Server.Execute). Every object you then instantiate using CreateObject() is enlisted in the transaction context (though not all resources support transactions), including ADO.Connection objects. Committing or aborting the ObjectContext causes all transacted objects to act accordingly. The On.. events will fire at the conclusion of the transaction.

If you do not use transacted ASP Pages, you must handle the transactions manually using ADO.Connection objects. This is fine, until you have two Connection objects. The two cannot be joined in a single transaction context, so you risk one committing and one aborting.

HTH

Craig Boland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top