FireDAC.Comp.DataSet.TFDDataSet.LoadFromStream

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure LoadFromStream(AStream: TStream; AFormat: TFDStorageFormat = sfAuto);

C++

void __fastcall LoadFromStream(System::Classes::TStream* AStream, Firedac::Stan::Intf::TFDStorageFormat AFormat = (Firedac::Stan::Intf::TFDStorageFormat)(0x0));

Properties

Type Visibility Source Unit Parent
procedure
function
public
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
FireDAC.Comp.DataSet TFDDataSet

Description

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:

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

Example

var
  oStr: TStream;
....
oStr := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('data'), bmRead);
try
  FDMemTable1.LoadFromStream(oStr, sfBinary);
finally
  oStr.Free;
end;

See Also