Opening and Closing Datasets

From InterBase

Go Up to Understanding Datasets


To read or write data in a table or through a query, an application must first open a dataset. You can open a dataset in two ways:

  • Set the Active property of the dataset to True, either at design time in the Object Inspector, or in code at runtime:
IBTable.Active := True;
  • Call the Open method for the dataset at runtime:
IBQuery.Open;

You can close a dataset in two ways:

  • Set the Active property of the dataset to False, either at design time in the Object Inspector, or in code at runtime:
IBQuery.Active := False;
  • Call the Close method for the dataset at runtime:
IBTable.Close;

You may need to close a dataset when you want to change certain of its properties, such as TableName on a TIBTable component. At runtime, you may also want to close a dataset for other reasons specific to your application.

Advance To: