ServerConnection.ProcessID 属性

Gets the ID value that uniquely identifies the process associated with the referenced connection to the server.

命名空间:  Microsoft.SqlServer.Management.Common
程序集:  Microsoft.SqlServer.ConnectionInfo(在 Microsoft.SqlServer.ConnectionInfo.dll 中)

语法

声明
Public ReadOnly Property ProcessID As Integer 
    Get
用法
Dim instance As ServerConnection 
Dim value As Integer 

value = instance.ProcessID
public int ProcessID { get; }
public:
property int ProcessID {
    int get ();
}
member ProcessID : int
function get ProcessID () : int

属性值

类型:System.Int32
An Int32 value that specifies the ID value that uniquely identifies the process associated with the referenced connection to the server.

示例

C#

ServerConnection conn = new ServerConnection();
Console.WriteLine(conn.ProcessID);

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
Write-Host $conn.ProcessID

请参阅

参考

ServerConnection 类

Microsoft.SqlServer.Management.Common 命名空间

其他资源

sp_who (Transact-SQL)

sys.sysprocesses (Transact-SQL)