Top Previous Next

Indicates the current operating mode of the dataset.


property State: TDataSetState;


Examine State to determine the current operating mode of the dataset. State determines what can be done with data in a dataset, such as editing existing records or inserting new ones. The dataset state constantly changes as an application processes data.

Opening a dataset changes State from dsInactive to dsBrowse. An application can call Edit to put a dataset into dsEdit state, or call Insert to put a dataset into dsInsert state. If a dataset is a TPSQLTable object, an application can call SetKey or SetRange to put the dataset into dsSetKey state.

Posting or canceling edits, insertions, or deletions, changes State from its current state to dsBrowse. Closing a dataset changes its state to dsInactive.

Some states, such as dsCalcFields, dsFilter, dsNewValue, dsOldValue, and dsCurValue cannot be seen or set directly by an application. These states are automatically set when OnCalcField and OnFilterRecord events occur, or when an application accesses certain field properties.

See also: Example: State,Seek,Truncate