Loading Data from a File or Stream

From RAD Studio
Jump to: navigation, search

Go Up to Using a Client Dataset with File-based Data


To load data from a file, call a client dataset's LoadFromFile method. LoadFromFile takes one parameter, a string that specifies the file from which to read data. The file name can be a fully qualified path name, if appropriate. If you always load the client dataset's data from the same file, you can use the FileName property instead. If FileName names an existing file, the data is automatically loaded when the client dataset is opened.

To load data from a stream, call the client dataset's LoadFromStream method. LoadFromStream takes one parameter, a stream object that supplies the data.

The data loaded by LoadFromFile (LoadFromStream) must have previously been saved in a client dataset's data format by this or another client dataset using the SaveToFile (SaveToStream) method, or generated from an XML document. For more information about saving data to a file or stream, see Using XML in database applications.

When you call LoadFromFile or LoadFromStream, all data in the file is read into the Data property. Any edits that were in the change log when the data was saved are read into the Delta property. However, the only indexes that are read from the file are those that were created with the dataset.

See Also