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

Must I call CreateObject on ADODB components to get proper protection? 1

Status
Not open for further replies.

entaroadun

Programmer
Sep 27, 2002
583
0
0
US
I have a component registered in COM+ that doesn't support transactions. It performs database-read operations with ADO.

Can I call:
Set cn = New ADODB.Connection

or do I have to:

Set cn = CreateObject("ADODB.Connection")

The connection is to a SQL Server 7. I know SQL Server will enforce connection pooling and all that but do I need COM+ to get involved as well for the resource savings?

If the question doesn't make sense, please let me know. I am new to this and my understanding of COM+ may not be conceptually correct.
 
Depends on if you are using MTS or Component Services.
In both cases if you don't care about the connection being in the current transaction then
Set cn = New ADODB.Connection
is fine.
Under Component Services that works the same as GetObjectContext.CreateInstance("ADODB.Connection")
Under MTS if you want a component to participate in the current transaction then you must use CreateInstance.

Hope this answers your question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top