...read a BlobStream with TADOQuery from an AccessDB?

Author: peppa

Category: Database

function GetBlobStream(Query: TADOQuery): TMemoryStream;
begin
  
result := TMemoryStream.Create;

  // You must connect to AccessDB first.
  // See: Query.Connection, TADOConection or Query.ConnectString

  // Send SQL command
  
Query.Active := False;
  Query.SQL.Clear;
  // data is my row and email the table
  
Query.SQL.Append('SELECT data FROM email WHERE id=1');
  Query.Active := True;

  Result.LoadFromStream(Query.CreateBlobStream(Query.FieldByName('Data'), bmRead));
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base