Expand Minimize
This topic has not yet been rated - Rate this topic

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  
);
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.

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.

Header: afxdb.h

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.