Data.DB.TDataSet.Active
Delphi
property Active: Boolean read GetActive write SetActive default False;
C++
__property bool Active = {read=GetActive, write=SetActive, default=0};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | Data.DB.pas Data.DB.hpp |
Data.DB | TDataSet |
Description
Specifies whether or not a dataset is open.
Use Active to determine or set whether a dataset is populated with data. When Active is false, the dataset is closed; the dataset cannot read or write data and data-aware controls can not use it to fetch data or post edits. When Active is true, the dataset can be populated with data. It can read data from a database or other source (such as a provider). Depending on the CanModify property, active datasets can post changes.
Setting Active to true:
- Generates a BeforeOpen event.
- Sets the dataset state to dsBrowse.
- Establishes a way to fetch data (typically by opening a cursor).
- Generates an AfterOpen event.
If an error occurs while opening the dataset, dataset state is set to dsInactive, and any cursor is closed.
Setting Active to false:
- Triggers a BeforeClose event.
- Sets the State property to dsInactive.
- Closes the cursor.
- Triggers an AfterClose event.
An application must set Active to false before changing other properties that affect the status of a database or the controls that display data in an application.
Note: Calling the Open method sets Active to true; calling the Close method sets Active to false.
See Also