CDaoRecordset::SetLockingMode
void SetLockingMode(BOOL bPessimistic**);
throw( CDaoException, CMemoryException );**
Parameters
bPessimistic
A flag that indicates the type of locking.
Remarks
Call this member function to set the type of locking for the recordset. When pessimistic locking is in effect, the 2K page containing the record you are editing is locked as soon as you call the Edit member function. The page is unlocked when you call the Update or Close member function or any of the Move or Find operations.
When optimistic locking is in effect, the 2K page containing the record is locked only while the record is being updated with the Update member function.
If a page is locked, no other user can edit records on the same page. If you call SetLockingMode and pass a nonzero value and another user already has the page locked, an exception is thrown when you call Edit. Other users can read data from locked pages.
If you call SetLockingMode with a zero value and later call Update while the page is locked by another user, an exception occurs. To see the changes made to your record by another user (and lose your changes), call the SetBookmark member function with the bookmark value of the current record.
When working with ODBC data sources, the locking mode is always optimistic.
For more information about updating data, see the article in Visual C++ Programmer's Guide. For related information, see the topics "LockEdits Property", "EditMode Property", and "Locking Behavior in Multiuser Applications" in DAO Help.
CDaoRecordset Overview | Class Members | Hierarchy Chart
See Also CDaoRecordset::GetLockingMode