Sign in Join
FPDoc Onlineexperiment

TCustomBufDataset.LoadFromFile procedure

Member of TCustomBufDatasetpublicIn unit BufDataset

Loads the dataset from the specified file using the given format.

Declaration

pascal
procedure LoadFromFile(const AFileName: string=''; 
                      Format: TDataPacketFormat=dfDefault)

Arguments

AFileName

File name with values loaded in the method.

Format

Format for values loaded in the method.

Description

LoadFromFile is a procedure used to load field definitions and record data from a file stored using a given data format.

AFileName is a String with the name of the file on the local file system. AFileName can contain optional path information, and should include the base name and extension for the file. For example:

ABufDataset.LoadFromFile('/usr/data/sample.bds');
          

or

ABufDataset.LoadFromFile('c:\usr\data\sample.bds');
          

The default value for AFileName is an empty string (''). When AFileName is an empty string, the value in the FileName property is used to load the content for the dataset. An Exception will be raised if both AFileName and FileName contain an empty String (''), or when the file name does not exist on the local file system.

Format is a TDataPacketFormat enumeration value that indicates the storage format used for the content in the file. The default value for Format is dfAny, and indicates that any registered data packet handler can be used to read the values in the file. Other values in the TDataPacketFormat enumeration indicate a specific registered data packet handler supporting a specific format should be used.

LoadFromFile creates a temporary TFileStream instance for the specified file name, and calls the LoadFromStream method to load the dataset from the stream using the specified file Format.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.