Loading FR3 files from database

To save the FR in Interbase-Blobfield I use this text in Delphi 6:

procedure TForm1.Button1Click(Sender: TObject);
begin
if not ibtransaction1.Active then ibtransaction1.StartTransaction;
ibsql3.ParamByName('document').LoadFromFile('test.fr3');
ibsql3.ExecQuery;
ibsql3.Close;
ibtransaction1.Commit;
end;

To load I edit this:

procedure TForm1.Button2Click(Sender: TObject);
var stream:tstream;
begin
stream:=ibdataset4.CreateBlobStream(ibdataset4.FieldByName('ausdruck'),bmread);
frxreport1.LoadFromstream(stream);
frxreport1.showreport;
stream.Free;
end;

By loading the report I receive the error: Invalid File format caused by the unit FrXXml. Where is the problem?

Comments

  • edited 12:00AM
    try:

    stream:=ibdataset4.CreateBlobStream(ibdataset4.FieldByName('ausdruck'),bmread);
    stream.seek(0,soFromBeginning);frxreport1.LoadFromstream(stream);
  • FRNLFRNL Hoogeveen - Netherlands
    edited 12:00AM
    I notice that you don't use the blob field for saving the report (don't know your query, don't know ibSQL) and I can imagine that if you need a blobfield for loading the report from the database, you also need a blobfield to save it.

    I suppose that the stream that you use to load the report will be empty and I suggest you test this by saving the stream to file after filling it from the blobfield.

    Wouldn't supprise me if this solves the problem.

    Kind regards,
    Teo

Leave a Comment