AnyDAC
ContentsIndexHome
PreviousUpNext
TADDataSet.SaveToStream Method

Saves a dataset's data to a stream.

Group
Links
Parameters 
Description 
AStream: TStream 
A stream to write. 
AFormat: TADStorageFormat = sfAuto 
A file format. 

Call SaveToStream to save the dataset data to an external file. 

AStream is the reference to the stream, to which the data to write. The dataset will start to write its data at current stream position. 

AFormat is the file format:

SaveToStream stores into the stream the items specified by the ResourceOptions.StoreItems.

procedure SaveToStream(AStream: TStream; AFormat: TADStorageFormat = sfAuto);
var
  oStr: TStream;
  ....
  ADQuery1.Edit;
  oStr := ADQuery1.CreateBlobStream(ADQuery1.FieldByName('data'), bmWrite);
  try
    ADMemTable1.SaveToStream(oStr, sfBinary);
  finally
    oStr.Free;
    ADQuery1.Post;
  end;
What do you think about this topic? Send feedback!