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 2:31AM
    Assign TfrxMasterData.Dataset with TfrxDBDataset too

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.