ConnectionManager.Properties Proprietà

Definizione

Ottiene una collezione di oggetti proprietà per il ConnectionManager. Questo è il metodo per accedere alle proprietà della connessione specifica che viene ospitata dal gestore di connessioni. Questa proprietà è di sola lettura.

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

Valore della proprietà

Una collezione che contiene le proprietà specifiche di quel tipo di DtsProperties connessione.

Implementazioni

Esempio

Il seguente esempio di codice ottiene la Properties collezione dal primo connection manager della Connections collezione usando la sintassi indice di [0]. Il campione poi scrive i nomi delle proprietà trovate nella Properties collezione.

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  

Output di esempio:

Stringa di connessione

CreationName

Descrizione

Documento d'identità

InitialCatalog

Name

Parola d’ordine

Livello di Protezione

RetainSameConnection

Nome del Server

Supporta le azioni DTCTransactions

UserName

Commenti

Tutte le classi che ereditano da il ConnectionManager contengono le stesse proprietà e metodi. Tuttavia, ogni tipo di connessione possiede proprietà aggiuntive specifiche per quel tipo di connessione. Quando ottieni un connection manager dalla collezione e iteri tra le proprietà, tutte le proprietà che non si trovano nella ConnectionManager classe sono proprietà specifiche di quella connessione. Per impostare una proprietà unica per la connessione, ma che non fa parte della ConnectionManager, come la RetainSameConnection proprietà trovata su diverse connessioni, si usa la seguente riga di codice:

ConnectionManager.Properties("RetainSameConnection") = True

Per ulteriori informazioni sul tipo di connessioni disponibili, vedi Connection Services di Integrazione (SSIS).

Si applica a