Loading report at runtime: exception th second time report is prepared

edited 2:10AM in FastReport 4.0
if i do ...

1 loadreport...
2 preparereport <---- this works

3 loadreport...
4 preparereport <--- here i have an exception (only if step 3 is executed): could not convert variant of type (null) into type (olestr)

the loadreport method load a report from a database blob field and is like this:

procedure loadreport(rpt:TfrxReport;field:TField);
var
stream:TStream;
begin
stream:=field.dataset.CreateBlobStream(TBlobField(field),bmRead);//s1.size=16126
if stream=nil then exit;

try
rpt.LoadFromStream(stream);
stream.position:=0;
finally
stream.free;
end;
end;

any suggestion ?

thanks
Delphi XE6, Fastreport 4.15.13

Comments

  • edited 2:10AM
    solved

    i need to set again report.variables after the report is loaded the second time.

    Roberto

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.