record locking rec in DBF (visual foxpro) table opened with OLEDB in VB.NET

J

JohnR

Hi, in VB.NET I'm accessing a DBF file using ADO with an OLEDB connection
with the Visual Foxpro OLEDB driver (VFPOLEDB.DLL). Read, write, update,
delete all work fine using a dataset.
Is there any automatic way to handle concurrent updates to the same record
by different users. How would it work? If I had to do it manually I'd use
a "last updated" timestamp and do something like this:

step 1. Read record without lock
step 2. modify record
step 3. read same record with lock
step 4. compare last updated timestamps
step 5. If they match then write the record and release lock
step 6. if they don't match then release record lock and disp error msg to
user

If I did this manually, I still don't know how to do a "read with record
lock" to protect the record during that small window between steps 3 and 5.

Right now I'm filling a dataset, modifying/deleting/adding records, then
doing a
DataAdapter.Update method. However, I'm open to a different method if
required to protect the database during concurrent updates on the same
record.

I heard about something called "pessimistic locking" and "optimistic
locking" (or something like
that). Would these apply to my case? If so how do they work?

Thanks, John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top