J
JohnR
Hi, in VB.NET I'm accessing a DBF file using ADO with an OLEDB connection
with the Visual Foxpro OLEDB driver (VFPODBC.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 using a dataset to do the update/delete/insert operations then
updating the database with a DataAdapter.Update method. I'm open to using
another technique if it's required to protect the records from concurrent
updates.
I heard about something called "pessimistic locking" and "optimistic
locking" (or something like
that). Would that apply to my case? If so how would it work?
I can't imagine this is an unusual requirement... I've never had a problem
figuring out
record locking in any other programming environment... .NET is very
powerful, but
it seems like some of what should be easy things, are not very obvious!
Thanks, John
with the Visual Foxpro OLEDB driver (VFPODBC.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 using a dataset to do the update/delete/insert operations then
updating the database with a DataAdapter.Update method. I'm open to using
another technique if it's required to protect the records from concurrent
updates.
I heard about something called "pessimistic locking" and "optimistic
locking" (or something like
that). Would that apply to my case? If so how would it work?
I can't imagine this is an unusual requirement... I've never had a problem
figuring out
record locking in any other programming environment... .NET is very
powerful, but
it seems like some of what should be easy things, are not very obvious!
Thanks, John