다음을 통해 공유


Package.Connections Property

Returns the collection of connection managers for the package.

네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

구문

‘선언
Public ReadOnly Property Connections As Connections
public Connections Connections { get; }
public:
property Connections^ Connections {
    Connections^ get ();
}
/** @property */
public Connections get_Connections ()
public function get Connections () : Connections

속성 값

A Connections collection.

주의

업데이트된 텍스트:2005년 12월 5일

Connection managers provide tasks with a generic interface to the underlying data store, allowing for simpler task implementation. Use the AcquireConnection method of the ConnectionManager object to retrieve the necessary connection information from any of the connection manager objects in the collection.

The connection manager can be referenced by GUID or by name, and you can store the name of the connection manager in a configuration file. To reference the connection by name, use \Package.Connections[myConnection].ConnectionString, instead of using \Package.Connections[{9930DA64-A413-4286-9C66-74EDADB4F393}].ConnectionString.

For more information about connections and connection managers, see Integration Services 연결.

The following example loads the UsingExecuteProcess package sample, and then retrieves the connections that are used by the package and displays some properties about the connections.

static void Main(string[] args)
        {
            // The variable pkg points to the location
            // of the ExecuteProcess package sample 
            // that is installed with the samples.
            string pkg = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

            Application app = new Application();
            Package p = app.LoadPackage(pkg, null);
            Connections conns = p.Connections;
            foreach (ConnectionManager cm in conns)
                Console.WriteLine("Name = " + cm.CreationName + ", HostType = " + cm.HostType);
        }
Shared  Sub Main(ByVal args() As String)
            ' The variable pkg points to the location
            ' of the ExecuteProcess package sample 
            ' that is installed with the samples.
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx" 
 
            Dim app As Application =  New Application() 
            Dim p As Package =  app.LoadPackage(pkg,Nothing) 
            Dim conns As Connections =  p.Connections 
            Dim cm As ConnectionManager
            For Each cm In conns
                Console.WriteLine("Name = " + cm.CreationName + ", HostType = " + cm.HostType)
            Next
End Sub

Sample Output:

Name = FILE, HostType = ConnectionManager

Name = OLEDB, HostType = ConnectionManager

Name = OLEDB, HostType = ConnectionManager

스레드 보안

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.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

Package Class
Package Members
Microsoft.SqlServer.Dts.Runtime Namespace