RAD Studio
ContentsIndex
PreviousUpNext
Loading Data from a File or Stream

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 Saving data to a file or stream. For information about creating client dataset data from an XML document, 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.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!