Author: Jason Madden
How can I read a BlobStream with TADOQuery from an AccessDB?
Answer:
1 2 function GetBlobStream(Query: TADOQuery): TMemoryStream;
3 begin4 result := TMemoryStream.Create;
5 6 // You must connect to AccessDB first.7 // See: Query.Connection, TADOConection or Query.ConnectString8 9 // Send SQL command10 Query.Active := False;
11 Query.SQL.Clear;
12 // data is my row and email the table13 Query.SQL.Append('SELECT data FROM email WHERE id=1');
14 Query.Active := True;
15 16 Result.LoadFromStream(Query.CreateBlobStream(Query.FieldByName('Data'), bmRead));
17 end;