How to lock the whole tabel using ADO ?

A

Albert

Hello Experts,

I try to lock a table in .MDB database to prevent others from write data to
it. Others are still allowed to read it. I have to do it by using ADO. How
can I do that ?

TIA,
Albert
 
M

Marcin Floryan

You simply have to pass right arguments with the Recordset Open method to
lock openned table. Reffer to ADO API Reference for more details.
An example follows:

Dim rst as ADODB.Recordset
rst.Open("users",conn,ADODB.CursorTypeEnum.adOpenDynamic,ADODB.LockTypeEnum.
adLockPessimistic)
 
A

Albert

Hello Floryan,

Is it possible to lock a table before editing it ?

In my case, that table (and other tables) will be editted and commit or
rollback within looping of transaction. After commit/rollback, locking is
released (I think). Then there is a gap of unlock between end of last
transaction and beginning of next transaction in loop. How to prevent this ?

Thanks again.
 

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