pessimistic locking

E

Eric

I have a fairly simple question:
- Can pessimistic locking be done with access?
- If so, should i use ODBC or OLEDB.

As far as i know pessimistic locking is not possible with OleDb when
connecting to an Access DB, not sure about ODBC.
 
P

Paul Clement

¤ I have a fairly simple question:
¤ - Can pessimistic locking be done with access?
¤ - If so, should i use ODBC or OLEDB.
¤
¤ As far as i know pessimistic locking is not possible with OleDb when
¤ connecting to an Access DB, not sure about ODBC.
¤

No, because by design the data access mechanism in ADO.NET, which enable inserts, updates and
deletes, only establishes a connection to the database at the time of the database operation.

The bottom line is that you cannot place a lock on a row (or page) while you are modifying the
contents of a row in memory (using a DataAdapter/DataSet/DataTable).


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
M

Miha Markic [MVP C#]

Hi Eric,

In addition to Paul, I think that it could be done by placing the whole
operation within a transaction.
Of course you shouldn't use it for UI and lengthy stuff.
 
E

Eric

Thanks for your help! A Transaction with Isolationlevel.Serializable
assigned is pessimistic locking right?
Unfortunately Access only supports Isolationlevel.ReadCommited. It seems
i've to live with that.

If I use 'classic' ADO is it possible to implement pessimistic locking with
Access?

Eric.

Miha Markic said:
Hi Eric,

In addition to Paul, I think that it could be done by placing the whole
operation within a transaction.
Of course you shouldn't use it for UI and lengthy stuff.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Eric said:
I have a fairly simple question:
- Can pessimistic locking be done with access?
- If so, should i use ODBC or OLEDB.

As far as i know pessimistic locking is not possible with OleDb when
connecting to an Access DB, not sure about ODBC.
 
P

Paul Clement

¤ Thanks for your help! A Transaction with Isolationlevel.Serializable
¤ assigned is pessimistic locking right?
¤ Unfortunately Access only supports Isolationlevel.ReadCommited. It seems
¤ i've to live with that.
¤
¤ If I use 'classic' ADO is it possible to implement pessimistic locking with
¤ Access?

Yes. Use a server side cursor, which is the default for an ADO connection, and a LockType of
adLockPessimistic.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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