Share via


Api.TryGetLock 方法

明確保留更新資料列、寫入鎖定或明確防止任何其他會話更新資料列、讀取鎖定的能力。 一般而言,資料列寫入鎖定會因為更新資料列而隱含地取得。 通常不需要讀取鎖定,因為記錄版本設定。 不過,在某些情況下,交易可能會想要明確鎖定資料列以強制執行序列化,或確保後續作業會成功。

Namespace:Microsoft.Isam.Esent.Interop
裝配: Microsoft.Isam.Esent.Interop (in Microsoft.Isam.Esent.Interop.dll)

語法

'Declaration
Public Shared Function TryGetLock ( _
    sesid As JET_SESID, _
    tableid As JET_TABLEID, _
    grbit As GetLockGrbit _
) As Boolean
'Usage
Dim sesid As JET_SESID
Dim tableid As JET_TABLEID
Dim grbit As GetLockGrbit
Dim returnValue As Boolean

returnValue = Api.TryGetLock(sesid, _
    tableid, grbit)
public static bool TryGetLock(
    JET_SESID sesid,
    JET_TABLEID tableid,
    GetLockGrbit grbit
)

參數

傳回值

類型: System.Boolean
如果取得鎖定,則為 True,否則為 false。 如果遇到非預期的錯誤,就會擲回例外狀況。

另請參閱

參考

Api 類別

Api 成員

Microsoft.Isam.Esent.Interop 命名空間