EPUB | CHM | PDF

TDataSet.Properties.Active

Top Previous Next

Specifies whether or not a dataset is open.

Syntax:

property Active: Boolean;

Description:

Use Active to determine or set a dataset's connection to data in a database. When Active is False, the dataset is closed; the dataset cannot read data from or write data to the database. When Active is True, data can be read from and written to the database.

Setting Active to True:

      • Triggers the BeforeOpen event handler if one is defined for the dataset;
      • Sets the dataset state to dsBrowse;
      • Opens a cursor into the dataset;
      • Triggers the AfterOpen event handler if one is defined for the dataset;
      • If an error occurs while opening the dataset, dataset state is set to dsInactive, and the cursor is closed;

An application must set Active to False before changing other properties that affect the status of the database or the controls that display data in an application.

Calling the Open method sets Active to True; calling the Close method sets Active to False.