ConnectionManager.Properties 属性

Gets a collection of property objects for the ConnectionManager. This is the method of accessing the properties of the specific connection that is being hosted by the connection manager. This property is read-only.

命名空间:  Microsoft.SqlServer.Dts.Runtime
程序集:  Microsoft.SqlServer.ManagedDTS(在 Microsoft.SqlServer.ManagedDTS.dll 中)

语法

声明
Public ReadOnly Property Properties As DtsProperties 
    Get
用法
Dim instance As ConnectionManager 
Dim value As DtsProperties 

value = instance.Properties
public DtsProperties Properties { get; }
public:
virtual property DtsProperties^ Properties {
    DtsProperties^ get () sealed;
}
abstract Properties : DtsProperties 
override Properties : DtsProperties
final function get Properties () : DtsProperties

属性值

类型:Microsoft.SqlServer.Dts.Runtime.DtsProperties
A DtsProperties collection that contains the properties specific to that connection type.

实现

IDTSPropertiesProvider.Properties

注释

All classes that inherit from the ConnectionManager contain the same properties and methods. However, each connection type has additional properties that are specific to that connection type. When you obtain a connection manager from the collection and iterate through the properties, all properties that are not found in the ConnectionManager class are properties that are specific to that connection. To set a property that is unique to the connection, but is not part of the ConnectionManager, such as the RetainSameConnection property found on several connections, use the following line of code:

ConnectionManager.Properties("RetainSameConnection") = True

For more information about the type of connections available, see Integration Services (SSIS) 连接.

示例

The following code example obtains the Properties collection from the first connection manager in the Connections collection using the index syntax of [0]. The sample then writes the names of the properties found in the Properties collection.

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

Sample Output:

ConnectionString

CreationName

Description

ID

InitialCatalog

Name

Password

ProtectionLevel

RetainSameConnection

ServerName

SupportsDTCTransactions

UserName

请参阅

参考

ConnectionManager 类

Microsoft.SqlServer.Dts.Runtime 命名空间