ConnectionManager.Properties プロパティ

定義

ConnectionManager のプロパティ オブジェクトのコレクションを取得します。 これは、接続マネージャーによってホストされている特定の接続のプロパティにアクセスするメソッドです。 このプロパティは読み取り専用です。

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

プロパティ値

その接続の種類固有のプロパティを表す DtsProperties コレクションです。

実装

次のコード例では、[0] のインデックス構文を使用している Properties コレクションの最初の接続マネージャーから Connections コレクションを取得します。 このサンプルでは、その後 Properties コレクションにあるプロパティの名前を書き込みます。

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace ConnMgr_Properties_Collection  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            // The package is one of the SSIS Samples.  
            string mySample = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";  

            // Create an application and load the sample.  
            Application app = new Application();  
            Package pkg = app.LoadPackage(mySample, null);  
            Connections myConns = pkg.Connections;  

            // Get the Properties collection from the connection  
            // manager and iterate through the properties,   
            // printing the property names.  
            ConnectionManager myConnMgr = myConns[0];  
            DtsProperties connProperties = myConnMgr.Properties;  

            foreach (DtsProperty connProp in connProperties)  
                Console.WriteLine(connProp.Name);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace ConnMgr_Properties_Collection  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            ' The package is one of the SSIS Samples.  
            Dim mySample As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"   

            ' Create an application and load the sample.  
            Dim app As Application =  New Application()   
            Dim pkg As Package =  app.LoadPackage(mySample,Nothing)   
            Dim myConns As Connections =  pkg.Connections   

            ' Get the Properties collection from the connection  
            ' manager and iterate through the properties,   
            ' printing the property names.  
            Dim myConnMgr As ConnectionManager =  myConns(0)   
            Dim connProperties As DtsProperties =  myConnMgr.Properties   

            Dim connProp As DtsProperty  
            For Each connProp In connProperties  
                Console.WriteLine(connProp.Name)  
            Next  
        End Sub  
    End Class  
End Namespace  

サンプル出力:

ConnectionString

CreationName

説明

id

InitialCatalog

名前

Password

ProtectionLevel

RetainSameConnection

ServerName

SupportsDTCTransactions

UserName

注釈

ConnectionManager から継承されるすべてのクラスには、同じプロパティおよびメソッドが含まれます。 ただし、それぞれの接続の種類には、それぞれに固有の追加のプロパティがあります。 コレクションから接続マネージャーを取得し、プロパティを繰り返し処理したときに、ConnectionManager クラスに存在しないプロパティは、すべてその接続に固有のプロパティです。 接続に対して一意であるが、ConnectionManager の一部ではないプロパティ (複数の接続にある RetainSameConnection プロパティなど) を設定するには、次のコード例を使用します。

ConnectionManager.Properties("RetainSameConnection") = True

使用可能な接続の種類の詳細については、「 Integration Services (SSIS) 接続」を参照してください。

適用対象