|
AnyDAC
|
Loads a dataset's data from a stream.
|
Parameters |
Description |
|
AStream: TStream |
A stream to load. |
|
AFormat: TADStorageFormat = sfAuto |
A file format. Default value is sfAuto. |
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 begining of the dataset data, otherwise loading will fail.
AFormat is the file format:
LoadFromStream tries to load from the stream the items specified by the ResourceOptions.StoreItems. If the stream was written with different StoreItems value, then exception will be raised likes this:
[AnyDAC][Stan]-712 Cannot read [Relationlist] objectprocedure LoadFromStream(AStream: TStream; AFormat: TADStorageFormat = sfAuto);
var oStr: TStream; .... oStr := ADQuery1.CreateBlobStream(ADQuery1.FieldByName('data'), bmRead); try ADMemTable1.LoadFromStream(oStr, sfBinary); finally oStr.Free; end;
|
What do you think about this topic? Send feedback!
|