procedure LoadFromStream(AStream: TStream; AFormat: TFDStorageFormat = sfAuto);
void __fastcall LoadFromStream(System::Classes::TStream* AStream, Firedac::Stan::Intf::TFDStorageFormat AFormat = (Firedac::Stan::Intf::TFDStorageFormat)(0x0));
Loads a dataset's data from a stream.
Use LoadFromStream to populate the dataset with data stored in an external file. The data is not moved to a database, but just loaded into a dataset in-memory storage.
AStream is the reference to the stream, containing the data to load. The stream position must be at beginning of the dataset data, otherwise the loading fails.
AFormat is the file format:
sfXML– a stream contains well formed stand-alone XML data.
sfBinary– a stream contains binary data with custom FireDAC format.
sfAuto– a format is determined by ResourceOptions.
sfJSON– a stream contains stand-alone JSON data.
LoadFromStream tries to load from the stream the items specified by ResourceOptions.StoreItems. If the stream was written with a different StoreItems value, then an exception like the following is raised:
[FireDAC][Stan]-712 Cannot read [Relationlist] object
var oStr: TStream; .... oStr := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('data'), bmRead); try FDMemTable1.LoadFromStream(oStr, sfBinary); finally oStr.Free; end;