Can I read + lock at the same time ?

A

Albert

I use ADO and OLE DB Provider for Microsoft Jet.

I 'ld like to know how you solve this kind of problem. I read records and I
want to sure that they will not be updated by other users until I finish my
processing. I allow other user to read it. I think this can be solved if and
only if I can lock all records when I read it. Not at the time when I update
it. Because there is nothing can confirm that records will not be changed by
other users after I have read it but before I can update it.

I have tested with .mode property. But it apply to whole database , all
tables. Have any properties else ?

TIA
 
S

Scott McDaniel

You can use adLockPessimistic when you open your recordset ... although this
is almost certain to cause problems in a multiuser situation. What happens
when UserA opens a recordset on ALL customer records ... and then goes to
lunch, after locking the workstation? Unless you've got code in place to
handle this, you're SOL. It sounds as if you may need to look into
Transactions, which allow you to run chunks of code and only complete the
Update IF all other related code events succeed.
 

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