ConnectionManager.InnerObject 属性

定义

返回创建的具体连接类型。 此属性为只读。

public:
 property System::Object ^ InnerObject { System::Object ^ get(); };
[System.ComponentModel.Browsable(false)]
public object InnerObject { get; }
[<System.ComponentModel.Browsable(false)>]
member this.InnerObject : obj
Public ReadOnly Property InnerObject As Object

属性值

包含托管项目的对象。 该对象被投射到匹配连接类型的类。 除了 中 Microsoft.SqlServer.Dts.ManagedConnections发现的连接外,这些连接对象都是原生的,必须转换为其原生类。 这可以通过 InnerObject 代码示例中显示的“System.__ComObject”值来体现。

实现

属性

示例

以下代码示例加载了一个已有的包,该包有两个连接。 它遍历包中的连接管理器,并打印出各种属性的值,包括 InnerObject

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

namespace Connections_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;  
            int connCount = myConns.Count;  
            Console.WriteLine("The number of connections in the package is: {0}", connCount);  

            // Enumerate over the collection, printing out  
            // the values for various properties.  
            foreach (ConnectionManager connMgr in myConns)  
            {  
                Console.WriteLine("ConnectionString:        {0}", connMgr.ConnectionString);  
                Console.WriteLine("CreationName:            {0}", connMgr.CreationName);  
                Console.WriteLine("DelayValidation:         {0}", connMgr.DelayValidation);  
                Console.WriteLine("Description:             {0}", connMgr.Description);  
                Console.WriteLine("HostType:                {0}", connMgr.HostType);  
                Console.WriteLine("ID:                      {0}", connMgr.ID);  
                Console.WriteLine("InnerObject:             {0}", connMgr.InnerObject);  
                Console.WriteLine("Name:                    {0}", connMgr.Name);  
                Console.WriteLine("ProtectionLevel:         {0}", connMgr.ProtectionLevel);  
                Console.WriteLine("SupportsDTCTransactions: {0}", connMgr.SupportsDTCTransactions);  
            }  
            Console.WriteLine("");  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace Connections_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   
            Dim connCount As Integer =  myConns.Count   
            Console.WriteLine("The number of connections in the package is: {0}", connCount)  

            ' Enumerate over the collection, printing out  
            ' the values for various properties.  
            Dim connMgr As ConnectionManager  
            For Each connMgr In myConns  
                Console.WriteLine("ConnectionString:        {0}", connMgr.ConnectionString)  
                Console.WriteLine("CreationName:            {0}", connMgr.CreationName)  
                Console.WriteLine("DelayValidation:         {0}", connMgr.DelayValidation)  
                Console.WriteLine("Description:             {0}", connMgr.Description)  
                Console.WriteLine("HostType:                {0}", connMgr.HostType)  
                Console.WriteLine("ID:                      {0}", connMgr.ID)  
                Console.WriteLine("InnerObject:             {0}", connMgr.InnerObject)  
                Console.WriteLine("Name:                    {0}", connMgr.Name)  
                Console.WriteLine("ProtectionLevel:         {0}", connMgr.ProtectionLevel)  
                Console.WriteLine("SupportsDTCTransactions: {0}", connMgr.SupportsDTCTransactions)  
            Next  

            Console.WriteLine("")  
        End Sub  
    End Class  
End Namespace  

示例输出:

该包中的连接数为:2

ConnectionString:数据来源=localhost;初始目录=冒险作品;Provider=SQLOLEDB.1;综合安全=SSPI;坚持安全信息=错误;自动翻译=错误;

创世名称:OLEDB

延迟验证:错误

说明:

HostType:ConnectionManager

编号:{3427BFE1-F10C-4B7E-8E70-E8D9DC7DDBA3}

内在物体:System.__ComObject

名称:localhost。冒险作品

保护级别:EncryptSensitiveWithUserKey

支持DTCTransactions:正确

ConnectionString:C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\results.txt

创建名称:FLATFILE

延迟验证:错误

说明:

HostType:ConnectionManager

编号:{48B66F8D-7DFE-4D85-91C7-0999655484B2}

内在物体:System.__ComObject

名称:按Product1划分的交易摘要

保护级别:EncryptSensitiveWithUserKey

支持DTCT行动:错误

适用于