How to Fastreport 3.0 report save database?

edited 8:23PM in FastReport 3.0
Hello

How to fastreport 3.0 reports import to MSSQL database ?

thanks

Comments

  • edited 8:23PM
    Load the report from a blob fields (via a stream)
    Modify your report and then save the report to the blob fields (via the stream)

    That's all ;)
  • edited 8:23PM
    Raphael

    In Delphi2005 I made this mode:

    var
    S: TStream;
    begin
    if (DM1.CDSREPORTS.Active) and (DM1.CDSREPORTS.Fields[0].AsInteger <> Null) then
    if OpenDialog.Execute then
    try
    DM1.CDSREPORTS.Edit;
    S:= TFileStream.Create(OpenDialog.FileName, fmOpenRead);
    TBlobField(DM1.CDSREPORTS.Fields[2]).LoadFromStream(S);
    DM1.CDSREPORTS.Post;
    DM1.CDSREPORTS.ApplyUpdates(0);
    finally
    S.Free;
    end;

  • edited 8:23PM
    Let's assume, you have a Blob Filed called "Report" and the table Name is "Reports":
    On the frxDesigner object, go to the Event "OnSaveReport" and put this code...

    function TForm1.frxDesigner1SaveReport(Report: TfrxReport;
    SaveAs: Boolean): Boolean;
    var template : TStream;
    begin
    template := TMemoryStream.Create;
    template.Position := 0;
    frxReport1.SaveToStream(template);
    Reports.Edit;
    try
    Reports.DisableControls;
    (Reports.FieldByName('Report') as TBlobField).LoadFromStream(template);
    Reports.Post;
    finally
    Reports.EnableControls;
    end;
    end;


    now, let's assume you have a button to print your report.... on the event "Onclick" put this code:

    procedure TForm1.btnPrintClick(Sender: TObject);
    var template : TStream;
    begin
    template := Reports.CreateBlobStream(Reports.FieldByName('Report'), bmRead);
    template.Position := 0;
    try
    frxReport1.LoadFromStream(template);
    frxReport1.ShowReport;
    finally
    template.Free;
    end;
    end;


    Hope this helps.
    Regards.

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.