Unit 'BufDataset' Package
[Overview][Types][Classes][Procedures and functions][Index] [#fcl]

TCustomBufDataset.LoadFromFile

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

Declaration

Source position: bufdataset.pas line 675

public procedure TCustomBufDataset.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

TCustomBufDataset.FileName

  

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

TCustomBufDataset.LoadFromStream

  

Loads the dataset from the specified stream using the given data format.


Documentation generated on: Nov 23 2024