Compartir a través de


CRecordset::SetLockingMode

Sets the locking mode to "optimistic" locking (the default) or "pessimistic" locking. Determines how records are locked for updates.

void SetLockingMode(
   UINT nMode 
);

Parameters

  • nMode
    Contains one of the following values from the enum LockMode:

    • optimistic   Optimistic locking locks the record being updated only during the call to Update.

    • pessimistic   Pessimistic locking locks the record as soon as Edit is called and keeps it locked until the Update call completes or you move to a new record.

Remarks

Call this member function if you need to specify which of two record-locking strategies the recordset is using for updates. By default, the locking mode of a recordset is optimistic. You can change that to a more cautious pessimistic locking strategy. Call SetLockingMode after you construct and open the recordset object but before you call Edit.

Requirements

Header: afxdb.h

See Also

Concepts

CRecordset Class

CRecordset Members

Hierarchy Chart

CRecordset::Edit

CRecordset::Update