The Page-Locking Challenge

One of the most common questions raised by developers who are starting their first Microsoft Jet multiuser application is: How do I lock a record? The short answer is: You don’t. You have seen that Microsoft Jet reads, writes, and locks data a page at a time, not a record at a time. Depending on the size of the record, the page may contain more than one record. The problem arises that by locking a record, you’re locking all the records on that page. This may cause a problem in high-concurrency applications where unhindered access to specific records is important. You can see how this works in Figure 6.5.

Figure 6.5 Page locking

You can use various strategies to work around this design: