[Overview][Constants][Classes][Index] | Reference for unit 'memds' (#fcl)

# TMemDataset.SaveToFile

Saves field definitions and optional record data to the specified file name

## Declaration

Source position: memds.pp line 144

`public procedure TMemDataset.SaveToFile(`
`AFileName: string`
`); procedure TMemDataset.SaveToFile(`
`AFileName: string;`
`SaveData: Boolean`
`);`

## Arguments

`AFileName` |  | File name used to store the content from the dataset

## Arguments

`AFileName` |  | File name used to store the content from the dataset
`SaveData` |  | True when record data is included in the stored file

## Description

SaveToFile is an overloaded procedure used to store field definitions and optional record data in the dataset to the specified file name. AFileName is the file name on the local file system used to store values from the dataset. SaveData indicates if record data is included in the values stored to the file. When SaveData contains False, only the field definitions for the dataset are stored in the file.

AFileName must contain a file name for the local file system. SaveToFile calls RaiseError to raise an exception if the value in AFileName is an empty string (''). SaveToFile creates a TFileStream for the specified file name, and calls SaveToStream to store the content from the dataset.

SaveToFile reimplements the method defined in the ancestor class.