ConnectionInfo.ID 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示分配给连接的 GUID。 此值为只读的。
public:
property System::String ^ ID { System::String ^ get(); };
public string ID { get; }
member this.ID : string
Public ReadOnly Property ID As String
属性值
分配给连接的 GUID。
实现
示例
下面的代码示例创建一个 Application 对象,循环访问计算机上的默认连接,然后列出每个连接的属性。 在此示例中, ID 显示为“{41F5EFE4-E91A-4EB0-BF10-D40FD48B3C03}”。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace ConnInfoTest
{
class Program
{
static void Main(string[] args)
{
Application dtsApplication = new Application();
ConnectionInfos connectionInfos = dtsApplication.ConnectionInfos;
foreach (ConnectionInfo connInfo in connectionInfos)
{
Console.WriteLine(connInfo.ConnectionContact);
Console.WriteLine(connInfo.ConnectionType);
Console.WriteLine(connInfo.CreationName);
Console.WriteLine(connInfo.Description);
Console.WriteLine(connInfo.FileName);
//Console.WriteLine(connInfo.FileNameVersionString);
Console.WriteLine(connInfo.IconFile);
Console.WriteLine(connInfo.IconResource);
Console.WriteLine(connInfo.ID);
Console.WriteLine(connInfo.Name);
Console.WriteLine(connInfo.UITypeName);
}
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace ConnInfoTest
Class Program
Shared Sub Main(ByVal args() As String)
Dim dtsApplication As Application = New Application()
Dim connectionInfos As ConnectionInfos = dtsApplication.ConnectionInfos
Dim connInfo As ConnectionInfo
For Each connInfo In connectionInfos
Console.WriteLine(connInfo.ConnectionContact)
Console.WriteLine(connInfo.ConnectionType)
Console.WriteLine(connInfo.CreationName)
Console.WriteLine(connInfo.Description)
Console.WriteLine(connInfo.FileName)
'Console.WriteLine(connInfo.FileNameVersionString)
Console.WriteLine(connInfo.IconFile)
Console.WriteLine(connInfo.IconResource)
Console.WriteLine(connInfo.ID)
Console.WriteLine(connInfo.Name)
Console.WriteLine(connInfo.UITypeName)
Next
End Sub
End Class
End Namespace
示例输出:
Microsoft Corporation
FILE
DTS.ConnectionManagerFile.1
Connection Manager for Files
C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DtsConn.dll
C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DtsConn.dll
0
{41F5EFE4-E91A-4EB0-BF10-D40FD48B3C03}
DTS Connection Manager for Files
Microsoft.DataTransformationServices.Design.SingleFileConnectionManagerUI,
Microsoft.DataTransformationServices.Design, Version=10.0.000.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91
注解
此属性显示为 ID 属性,该属性通常显示在连接的 “属性 ”对话框中。