ComponentOne True DataControl 8.0
LockType Property

 

LockType Property

Sets/returns the type of locking (concurrency) to use.

Syntax

TData.LockType = value

Remarks

Read/Write at run time and design time. Property applies to TData control and TDataLite control.

 

Values

Description

-1

adLockUnspecified

1

adLockReadOnly

2

adLockPessimistic

3

adLockOptimistic (default)

4

adLockBatchOptimistic

 

This property determines the type of locks placed on records during editing. In particular, it determines if the TData Recordset is read only (1 – adLockReadOnly) and if the batch update mode is used (4 – adLockBatchOptimistic).

LockType is a standard ADO recordset property. It applies both to Recordset (in all data modes) and to SourceRecordset (only in data source mode).

When set to -1 – adLockUnspecified, the type of locks and whether the recordset may be modified are determined by the data provider. This setting is only applicable in data source mode.

When set to 1 – adLockReadOnly, the Recordset is read-only, users can’t alter the data.

When set to 2 – adLockPessimistic, the Recordset employs pessimistic locking, record by record. The provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately upon editing.

When set to 3 – adLockOptimistic, the Recordset uses optimistic locking, record by record. The provider locks records only when the Recordsets Update method is called.

The 4 – adLockBatchOptimistic setting is equivalent to adLockOptimistic, but it also enables the batch update mode. When an ADO recordset is in batch update mode, changes are not transferred to the data source (database) until the recordset’s UpdateBatch method is called. If it is not in batch update mode, changes are transferred to the data source on leaving the current row and when the recordset’s Update method is called.

LockType can be set at any time during the control’s lifetime, but it will take effect only if set at design time, in the WillOpenData event or after the Refresh method is called.

See Also

TData Control

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback