Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Problem With SaveToDatabase

edited May 2009 in General
I'm using ReportBuilder 11.04 with Delphi 2009 on Vista Ultimate.

I now have a problem with code that was working from Delphi 6. I moved from
Delphi 6 to Delphi 2009.

When I attempt to SaveToDatabase, the resulting file is gibberish.

Here is how I am set up:

ppReport1.SaveAsTemplate := True;
ppReport1.Template.DatabaseSettings.DataPipeline := plReports;
ppReport1.Template.DatabaseSettings.Name :=
cdsReports.FieldByName('ReportName').AsString;
ppReport1.Template.DatabaseSettings.NameField := 'ReportName';
ppReport1.Template.DatabaseSettings.TemplateField := 'REPORTOBJECT';
ppReport1.Template.SaveTo := stDatabase;
ppReport1.Template.Format set as ftASCII;
ppReport1.Template.LoadFromDatabase;
ppReport1.Template.OnNew := NewReport;
ppReport1.DataPipeline := plMain;
ppDesigner1.IniStorageName := 'RBuilder';
ppDesigner1.IniStorageType := 'Registry';

I then make changes to the report and try to close it:

procedure TtmplRptInstrumentIndexForm.ppDesigner1Close(Sender: TObject; var
Action: TCloseAction);

begin
Action := caFree;
if Sender = nil then Exit;
if not (Sender is TppDesignerWindow) then Exit;
if TppDesignerWindow(Sender).CurrentReport = nil then Exit;
with (TppDesignerWindow(Sender).CurrentReport) do
begin
if Modified then
begin
MessageBeep(mb_IconQuestion);
if MessageDlg('Report has been modified. Do you wish to save
it?',mtConfirmation,[mbYes,mbNo],0) <> mrYes then
Exit;
Template.SaveToDatabase;
end;
end
end;

The next time that I try to edit the report I get an invalid template
command. When I save the RTM file to disk and open the RTM file in a text
editor it is not readable.

What am I doing wrong?

Thanks,

Al

Comments

  • edited May 2009
    Hi Al,

    Which database are you using to store your templates? If you load the
    end-user demo for the database and connectivity you are using, do you still
    get the error? If so, please give us the steps we can take to recreate the
    behavior on our machines.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.