Load picture from DB field

Hello,

I searched the forum already and saw a few similar topics, but it did not help.

I have TfrxDBDataset on the form attached to in-memory dataset. The picture is stored in BLOB field of this dataset, in BMP format.

I then have TfrxReport on the same form and TfrxPictureView in it. I tried to link it directly with Dataset and DataField properties, but the result is empty report.

Then i tried to put some code in

procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
with Picture1.Dataset.Dataset do
Picture1.Picture.LoadFromFile(FieldByName('file_location').AsString + FieldByName('file_name').AsString)
end;

How do i reference the dataset here? I tried to use TMemoryStream to pass the data over, but getting compile error, something like Cant convert variant type NULL into Integer.

Thank you.

Comments

  • gpigpi
    edited 1:57AM
    Assign TfrxMasterData.Dataset with TfrxDBDataset too

Leave a Comment