[Overview][Types][Classes][Procedures and functions][Index] Reference for unit 'BufDataset' (#fcl)

TCustomBufDataset.CreateDataset

Creates the dataset using its field definitions or bound fields

Declaration

Source position: bufdataset.pas line 651

public procedure TCustomBufDataset.CreateDataset;

Description

CreateDataset is a procedure used to create the structure for a buffered dataset using the field definitions or bound fields defined in the class instance. CreateDataset calls CheckInactive to ensure that the dataset has not been opened. An exception is raised if the Active property contains True.

CreateDataset uses the FieldDefs and Fields properties to determine which property contains the structure for the dataset.

Preference is given to the FieldDefs property; it will be used even when bound fields have been created in the Fields property. The CreateFields method is called to created a bound field for each of the items in the FieldDefs collection.

The Fields property is used when there are no field definitions present in the FieldDefs property. The InitFieldDefsFromFields method is called to create a field definition in FieldDefs for each of the items in Fields collection. The BindFields method is called to link the items in Fields to the corresponding field definition in FieldDefs.

An exception is raised if both FieldDefs and Fields are empty.

CreateDataset sets the default value for an auto-increment field in the dataset to 1. CreateDataset also temporarily clears any value assigned to the FileName property; this is done to ensure that fields and record data in an existing file are not loaded when the dataset is Opened. The method is designed to create a dataset with field definitions but no record data. The value in FileName is restored after Open has been called in the method.

See also

TDataset.Active

  

Is the dataset open or closed.

TDataset.FieldDefs

  

Definitions of available fields in the underlying database

TDataset.Fields

  

Indexed access to the fields of the dataset.

TDataset.Open

  

Activate the dataset: Fetch data into memory.

TCustomBufDataset.FileName

  

File name on the local file system used to load or store the dataset


Documentation generated on: Jun 23 2021