|
AnyDAC
|
TADBlobStream is a stream object giving access to BLOB / Memo fields.
uADCompDataSet
Use TADBlobStream to read or modify the value of BLOB field. The BLOB field is a field of one of the following data types:
To create TADBlobStream use TADDataSet.CreateBlobStream method or just create TADBlobStream object explicitly using Create constructor.
To modify content of BLOB field, dataset must be in dsEdit / dsInsert mode and field must be ReadOnly = False.
TADBlobStream = class(TMemoryStream);
TADDataSet.CreateBlobStream
The demo shows how to load BLOB field value from external file
ADQuery1.Append;
// assign other fields
....// load BLOB field value
oStr := TADBlobStream.Create(ADQuery1.FieldByName('PHOTO'), bmWrite);try oStr.LoadFromFile('c:\aaa.jpg'); finally oStr.Free; end; ADQuery1.Post;
The demo shows how to save BLOB field value into external file
// save BLOB field value oStr := TADBlobStream.Create(ADQuery1.FieldByName('PHOTO'), bmRead); try oStr.SaveToFile('c:\aaa.jpg'); finally oStr.Free; end;
See AnyDAC\Samples\Comp Layer\TADQuery\Blobs demo for details.
|
What do you think about this topic? Send feedback!
|