SQL Server
1 out of 2 rated this helpful - Rate this topic

ConnectionManager.AcquireConnection Method

Creates an instance of the connection type.

Namespace: Microsoft.SqlServer.Dts.Runtime
Assembly: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
public Object AcquireConnection (
	Object txn
)
public Object AcquireConnection (
	Object txn
)
public function AcquireConnection (
	txn : Object
) : Object

Parameters

txn

The handle to a transaction type.

Return Value

An object that contains the transaction connection.

Pass null for the transaction parameter txn when the SupportsDTCTransactions property is false. If the SupportsDTCTransactions property is true, you can pass null 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.

// 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);
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ