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

TCustomBufDataset.SaveToFile

Saves the dataset to the specified file using the given data format

Declaration

Source position: bufdataset.pas line 650

public procedure TCustomBufDataset.SaveToFile(

  AFileName: string = '';

  Format: TDataPacketFormat = dfBinary

);

Arguments

AFileName

  

File name where the dataset is stored`

Format

  

Format for values written in the method

Description

SaveToFile is a procedure used to save the content from the buffered dataset to the specified file name 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.SaveToFile('/usr/data/sample.bds');
          

or

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

The default value for AFileName is an empty string (''). When AFileName is omitted, the value in the FileName property will be used to save the content for the dataset. An Exception will be raised if both AFileName and FileName contain an empty String ('').

Format is a TDataPacketFormat enumeration value that indicates the storage format to use when writing the content for the file. The default value for Format is dfBinary, and indicates that the TFpcBinaryDatapacketReader should be used to write 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.

SaveToFile creates a temporary TFileStream instance for the specified file name, and calls the SaveToStream method to store the dataset to the stream in the required Format.

See also

TCustomBufDataset.FileName

  

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

TCustomBufDataset.SaveToStream

  

Saves the dataset to the specified stream using the given data format


Documentation generated on: May 14 2021