Saving a TOleContainer object into Blob-Field

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
barnie00
Posts: 11
Joined: Mon 24 Sep 2007 20:37

Saving a TOleContainer object into Blob-Field

Post by barnie00 » Sun 12 Oct 2008 23:29

Hello!

Ich have a TOleContainer containing a graphic object.
How can I copy the Data into a Firebird blobfield?

Thank you.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 13 Oct 2008 07:44

You can try the following code:

Code: Select all

var
  Stream: TStream;
begin
  IBCQuery.SQL.Text := 'SELECT * FROM IBDAC_BLOB';
  IBCQuery.Open;
  IBCQuery.Edit;
  Stream := IBCQuery.CreateBlobStream(IBCQuery.FieldByName('PIC'), bmWrite);
  try
    OleContainer1.SaveToStream(Stream);
  finally
    Stream.Free;
  end;
  IBCQuery.Post;
end;

Post Reply