Load from blob

Hello. I use this code to put/get fastreport 3 file from blob fields.

To put:
frxreport.loadfromfile(' ... somefile.fr3');
with SQLComponent do
begin
               Close;
               SQL.Clear;
               SQL.Add(' UPDATE FORMULARIOS SET BINFORME = :informe ' +
                       ' WHERE NCOD_FORMULARIO = 1');
               DocumentoStr := TMemoryStream.Create;
               DocumentoStr.Position:=0;
               frxReport.SaveToStream(DocumentoStr);
               ParamByName('informe').LoadFromStream(DocumentoStr);
               ExecQuery;
               DocumentoStr.Free;
end;

To get:
with SQLComponent do
begin
        SQL.Add(' SELECT BINFORME FROM FORMULARIOS WHERE ' +
                      ' NCOD_FORMULARIO=1');
        Active := True;
        if fields[0].value <> null then
        begin
                    DocumentoStr:=TMemoryStream.Create;
                    DocumentoStr.Position:=0;
                    TBlobField(FieldByName('binforme')).SaveToStream(DocumentoStr);
                    frxReport.LoadFromStream(DocumentoStr);
                    DocumentoStr.Free;
        end
        else Report.Clear;
end;

But when it execute frxreport.loadfromstream it gives me: "invalid file format" on frxXML unit.

What Can I do?
;)

Comments

  • edited 1:31PM
    I've found the problem. Altough I didn't use frxBarCode, frxOle.... when I designed my report, They must be inserted on the form to load well.
    Thanks.

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.