Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

PipelineComponent.AcquireConnections Method (Object)


Establishes a connection to a connection manager.

Namespace:   Microsoft.SqlServer.Dts.Pipeline
Assembly:  Microsoft.SqlServer.PipelineHost (in Microsoft.SqlServer.PipelineHost.dll)

public virtual void AcquireConnections(
	object transaction


Type: System.Object

The transaction the connection is participating in.

AcquireConnections is called during both component design and execution. Components that connect to external data sources should establish their connections during this method. Any connection established during this method should be cached in a local member variable and released in the ReleaseConnections method. Connections should only be established during AcquireConnections.

The following example shows a component that connects to an ADO.NET connection manager during AcquireConnections.

public override void AcquireConnections(object transaction)
    if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager != null)
            // Convert the native IDTSConnectionManager100 to the managed ConnectionManager,
            // then retrieve the underlying connection through the InnerObject.
            ConnectionManager cm = Microsoft.SqlServer.Dts.Runtime.DtsConvert.ToConnectionManager(ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);
            ConnectionManagerAdoNet cmado = cm.InnerObject  as ConnectionManagerAdoNet;

            // If the InnerObject is not an ConnectionManagerAdoNet, then
            // the cmado object is null.
            if( cmado == null )
                throw new Exception("The ConnectionManager " + cm.Name + " is not an ADO.NET connection.");

            // Get the underlying connection object.
            this.oledbConnection = cmado.AcquireConnection(transaction) as OleDbConnection;

            if( this.oledbConnection == null )
                throw new Exception("The ConnectionManager " + cm.Name + " is not an ADO.NET connection.");

            isConnected = true;
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft