Package.Connections 속성

정의

패키지에 대한 연결 관리자의 컬렉션을 가져옵니다.

public:
 property Microsoft::SqlServer::Dts::Runtime::Connections ^ Connections { Microsoft::SqlServer::Dts::Runtime::Connections ^ get(); };
public Microsoft.SqlServer.Dts.Runtime.Connections Connections { get; }
member this.Connections : Microsoft.SqlServer.Dts.Runtime.Connections
Public ReadOnly Property Connections As Connections

속성 값

Connections

패키지에 대한 연결 관리자의 컬렉션입니다.

예제

다음 예제에서는 UsingExecuteProcess 패키지 샘플을 로드한 다음 패키지에서 사용하는 연결을 검색하고 연결에 대한 일부 속성을 표시합니다.

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\100\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\100\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  

샘플 출력:

Name = FILE, HostType = ConnectionManager

Name = OLEDB, HostType = ConnectionManager

Name = OLEDB, HostType = ConnectionManager

설명

연결 관리자는 기본 데이터 저장소에 대한 일반 인터페이스를 사용하여 작업을 제공하여 더 간단한 작업 구현을 허용합니다. 개체의 AcquireConnection 메서드를 ConnectionManager 사용하여 컬렉션의 연결 관리자 개체에서 필요한 연결 정보를 검색합니다.

연결 관리자는 GUID 또는 이름으로 참조할 수 있으며 구성 파일에 연결 관리자의 이름을 저장할 수 있습니다. 이름으로 연결을 참조하려면 \Package.Connections[{9930DA64-A413-4286-9C66-74EDADB4F393}].ConnectionString를 사용하는 대신 다음을 사용합니다\Package.Connections[myConnection].ConnectionString.

연결 및 연결 관리자에 대한 자세한 내용은 Integration Services(SSIS) 연결을 참조하세요.

적용 대상