Title: Blob and ADO Part 2.
Question: Retrieving BLOB data from a database using ADO
Answer:
That's really easy :
var
StampStream : TMemoryStrem;
begin
StampStream := TMemoryStream.Create;
try
ADOQuery1.Close;
ADOQuery1.SQL.CLear;
ADOQuery1.SQL.Add('Select BlobField from Table');
ADOQuery1.Open;
ADOQuery1.First;
StampStream.Clear;
TBlobField(ADOQuery1.FieldByName('BlobField')).SaveToStream(StampStream);
// ... do whatever with your stream
finally
StampStream .Free;
end;
end;
Tested with
MSSQL, Interbase, SQLAnywhere, Access.
Connected using ADO+ODBC.
Hope this helps,
Florin