Lock data record
The ADO component has a very good attribute LockType, which can be used to lock records, so you can check this property before a update begins, if you are still locked, you need to wait to avoid update conflicts. This property is specifically described below: LockType property Indicates the type of lock used during the editing process. Setting and return value setting or returning the value of a LockTyPeenum below. Constant illustrates the ADLOCKREADONLY default value, read only. Unable to change the data. AdlockPESSIMISTIC conservative record lock (strip). The provider performs the necessary operations to ensure successful editing records, usually using the record of the data source immediately when editing. AdlockOptimistic open record lock (strip). The provider uses an open lock to lock the record only when the Update method is called. AdlockBatchOptimistic open batch update. The batch update mode is used to update now. Note To open RecordSet Set the LockType property to specify the lock type that the provider should use when the open is open. Read this property returns the type of lock that is using on the open Recordset object. The LockType property is read / written when Recordset is closed. This property is read-only. The provider may not support all lock types. If a provider does not support the required LockType settings, it will be replaced with other types of locks. To determine the actual lock function available for the Recordset object, use the Supports method with AduPdate and AduPdateBatch. If the CursorLocation property is set to AduseClient, AdlockPessimistic settings will not be supported. Settings that are not supported do not generate errors because the value of the closest LockType will be used at this time. Remote Data Services When used on the client (Ador) RecordSet object, the LockType property can only be set to AdlockOptimisticbatch. Note: Update data before using transaction: adoConnection.begintrans; // Start a transaction try // Here you write update database statements. Adoconnection.commitTrans // Submit an transaction Except adoconnection.rollbackTrans; // The transaction fails rollback transaction, Abandon all updated operations;