Database Locking using VBA (Visual Basic for Applications)

Database Locking using VBA (Visual Basic for Applications)

Database Locking

Lock Type property determines the lock type on record set while editing. It is derived from LockTypeEnum the default lock is adLockReadOnly. LockType property can be set before opening a Recordset to let the database know what type of locking the provider should use when opening the recordset..

Different Locks

  1. adLockBatchOptimistic
  2. adLockOptimistic
  3. adLockPessimistic
  4. adLockReadOnly

adLockBatchOptimistic

Batch update locking in optimistic manner like record by record.

adLockOptimistic

A record by record locking and provider will perform lock when update is called.

adLockPessimistic

A record by record locking and provider will perform lock right after editing.

adLockReadOnly

Set locking to read only mode where only SELECT statement can be performed to fetch the data from database.

Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.

Leave a Reply

Your email address will not be published. Required fields are marked *