Share via


EnumLocks 方法 (Int32)

列舉 SQL Server 執行個體上指定之處理序所持有的目前鎖定清單。

命名空間:  Microsoft.SqlServer.Management.Smo
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
Public Function EnumLocks ( _
    processId As Integer _
) As DataTable
'用途
Dim instance As Server
Dim processId As Integer
Dim returnValue As DataTable

returnValue = instance.EnumLocks(processId)
public DataTable EnumLocks(
    int processId
)
public:
DataTable^ EnumLocks(
    int processId
)
member EnumLocks : 
        processId:int -> DataTable 
public function EnumLocks(
    processId : int
) : DataTable

參數

傳回值

型別:System.Data. . :: . .DataTable

DataTable 系統物件值,包含 SQL Server 執行個體上指定之處理序所持有的目前鎖定清單。下表將描述傳回之 DataTable 的不同資料行。

資料行

資料類型

說明

RequestorSpid

Int32

SQL Server 處理序識別碼,此識別碼會唯一識別要求鎖定的處理序。

LockType

String

鎖定類型。請參閱<sys.syslockinfo (Transact-SQL)>中的<req_mode>。

資料庫

String

包含鎖定的資料庫名稱。

結構描述

String

鎖定之資源的結構描述。

資料表

String

包含鎖定的資料表。

索引

String

包含鎖定的索引。

狀態

Int32

鎖定的狀態。1 表示授與、2 表示轉換,3 表示等候。

備註

Use this method to determine the locks that are currently held on the instance of SQL Server. The information that is returned can help you identify locking problems that might affect performance.