Click to Rate and Give Feedback
TechNet
TechNet Library
SQL Server
SQL Server 2008 R2
Technical Reference
 AcquireConnection Method
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
Other versions are also available for the following:
ConnectionManager..::.AcquireConnection Method

Creates an instance of the connection type.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)
Visual Basic (Declaration)
Public Function AcquireConnection ( _
    txn As Object _
) As Object
Visual Basic (Usage)
Dim instance As ConnectionManager
Dim txn As Object
Dim returnValue As Object

returnValue = instance.AcquireConnection(txn)
C#
public Object AcquireConnection(
    Object txn
)
Visual C++
public:
Object^ AcquireConnection(
    Object^ txn
)
F#
member AcquireConnection : 
        txn:Object -> Object 
JScript
public function AcquireConnection(
    txn : Object
) : Object

Parameters

txn
Type: System..::.Object
The handle to a transaction type.

Return Value

Type: System..::.Object
An object that contains the transaction connection.

Pass nullNothingnullptra null reference (Nothing in Visual Basic) for the transaction parameter txn when the SupportsDTCTransactions property is false. If the SupportsDTCTransactions property is true, you can pass nullNothingnullptra null reference (Nothing in Visual Basic) in the transaction parameter to indicate that the container supports transactions, but is not going to participate.

The following code example shows how to add the OLE DB connection to the connection manager and acquire the connection.

C#
// Create the package.
Package pkg = new Package();

// Add a ConnectionManager to the Connections collection.
ConnectionManager connMgr = pkg.Connections.Add("ADO.NET:OLEDB");
connMgr.Properties["RetainSameConnection"].SetValue(connMgr , true);
connMgr.ConnectionString = connStr;

// Aqcuire the connection.
object connection = connMgr.AcquireConnection(null);
Visual Basic
' Create the package.
Dim pkg As Package =  New Package() 
 
' Add a ConnectionManager to the Connections collection.
Dim connMgr As ConnectionManager =  pkg.Connections.Add("ADO.NET:OLEDB") 
connMgr.Properties("RetainSameConnection").SetValue(connMgr , True)
connMgr.ConnectionString = connStr
 
' Aqcuire the connection.
Dim connection As Object =  connMgr.AcquireConnection(Nothing)
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker