Using ADO to Communicate with the Database, Part 1 - What Are the Lock Types?
(Page 3 of 5 )
If multiple users try to update the same record at the same time, an error will occur. When locking your records, you will either be optimistic (adLockOptimistic) that this error won't occur, or you will be pessimistic (adLockPessimistic) and figure this error is likely to happen. So we require to implement some locking strategy. So Lock Type is required because, it determines how to implement concurrent sessions, specially when the solution is supposed to run in a network environment. How to lock the records when the application will run on a network. In optimistic locking, other users are only locked out of the record(s) when the Update method is called - probably just a split second. In pessimistic locking, other users are locked out for the entire period that the records are being accessed and modified.
Navigating Through a Recordset?
Recordset is a collection of one or more rows from the database and table specified by you. So you must be able to navigate (Move) through this collection of rows. The Move method moves to a record in a database specified by a row number.
- Move: The Move method moves to a record in a database specified by a row number (e.g adoRS.Move 4 will move the recordset to fourth record)
- MoveFirst: Moves to the first record in the recordset
- MoveLast: Moves to the last record in the recordset
- MovePrevious: The MovePrevious method moves to the previous record in the recordset. The BOF property should be checked to prevent an error occurring. BOF is set to True if the current record is before the first record in the recordset
- MoveNext: The MoveNext method moves to the next record in the recordset. The EOF property should be checked to prevent an error occurring. EOF is set to True if the current record is after the last record in the recordset
Next: Bringing All Together >>
More Database Code Articles
More By Pradeep Chaudhary