ConnectionManager.InnerObject 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回创建的特定连接类型。 此属性为只读。
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;Initial Catalog=AdventureWorks;Provider=SQLOLEDB.1;Integrated Security=SSPI;持久保存安全信息=False;自动翻译=False;
CreationName:OLEDB
DelayValidation: False
说明:
HostType:ConnectionManager
ID: {3427BFE1-F10C-4B7E-8E70-E8D9DC7DDBA3}
InnerObject:System.__ComObject
名称:localhost。AdventureWorks
ProtectionLevel:EncryptSensitiveWithUserKey
SupportsDTCTransactions: True
ConnectionString: C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\results.txt
CreationName:FLATFILE
DelayValidation: False
说明:
HostType:ConnectionManager
ID: {48B66F8D-7DFE-4D85-91C7-099965484B2}
InnerObject:System.__ComObject
名称:按 Product1 列出的事务摘要
ProtectionLevel:EncryptSensitiveWithUserKey
SupportsDTCTransactions: False