Record-Level Locking and DAO 
Author Message
 Record-Level Locking and DAO

Hello there!

When opening an Access2000-database by an MFC-application via the DAO
classes from MFC, how can I force the database engine to use Record-Level
Locking ?

Thanks for your efforts.
Klaus Armbruster



Sat, 16 Oct 2004 23:31:32 GMT  
 Record-Level Locking and DAO
Klaus,

have a look at these links:

http://msdn.microsoft.com/library/en-us/odeopg/html/deovrpagelevelloc...
ecordlevellocking.asp

http://msdn.microsoft.com/library/en-us/odeopg/html/deovrlockingshare...
usingrecordsetobjectsinvba.asp

and this from the Office 2000 VBA Programmers guide (same as link above):

After you open the database in shared mode, you can implement recordset
locking by specifying either of the dbDenyRead and dbDenyWrite constants in
the Options argument of the DAO OpenRecordset method. You can also combine
both constants by using the plus (+) operator if you want to apply both read
and write locks to the table.

To open a DAO Recordset object with recordset locking
1. Open the Recordset object's database in shared mode.
2. Determine the type of recordset locking you want to use.
3. Open the Recordset object by using the OpenRecordset method and set the
Options argument to specify the type of locking that you want.
4. Close the Recordset object when you're finished performing operations on
the data to release any locks on the Recordset object.

For example, the following code locks a table by opening it with the
dbDenyWrite and dbDenyRead constants specified in the Options argument of
the OpenRecordset method. For the duration of the procedure, no other users
can access this table. If an error occurs when you try to open the table,
the function returns Nothing. This procedure requires the DAOOpenDBShared
procedure, which attempts to open a database in shared mode and handles
errors if it can't. The DAOOpenDBShared and DAOOpenTableExclusive procedures
can be found in the RecordsetLocking module of the MultiuserDatabase.mdb
sample file, which is available in the ODETools\V9\Samples\OPG\Samples\CH16
subfolder on the Office 2000 Developer CD-ROM.

I hope this helps,
Roy Fine


Quote:
> Hello there!

> When opening an Access2000-database by an MFC-application via the DAO
> classes from MFC, how can I force the database engine to use Record-Level
> Locking ?

> Thanks for your efforts.
> Klaus Armbruster



Sun, 17 Oct 2004 07:08:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Record-Level Locking and DAO

2. row-level locking with DAO

3. row-level locking with DAO

4. Record Locking with reading records

5. Jet 4.0 record- and page-level locking using MFC DAO...

6. DAO & Indexes - Adding records/Current record

7. Row Level Locking

8. row level locking under VC++/MFC/CRecordset and ODBC with SQL 7.0

9. row-level locking

10. row level locking under VC++/MFC/CRecordset and ODBC with SQL7.0

11. Setting Recording Level

12. How do I hold a Lock on a record

 

 
Powered by phpBB® Forum Software