Creating a report from a stored TClientDataSet
I have a defined report structure (in a .fp3 file) and I have a dump using TClientDataSet.SaveToFile().
First I tried with a TDataSource:
But that resulted in an access violation. When I try without the TDataSource, I get a 'Cannot find class TfrxDBDataset'.
What am I doing wrong?
First I tried with a TDataSource:
var
  NSet: TClientDataSet;
  NSrc: TDataSource;
  FSet: TfrxDBDataset;
begin
  NSet := TClientDataSet.Create(self);
  NSet.LoadFromFile(Dumpfilename);
  NSet.Name := 'procname';
  NSrc := TDataSource.Create(self);
  NSrc.DataSet := NSet;
  frxReport1.LoadFromFile('structure.fp3');
  FSet := TfrxDBDataSet.Create(frxReport1.Pages[0]);    // Attach to DataPage.
  FSet.DataSource := NSrc;
  FSet.Name := NSet.Name;
  FSet.UserName := NSet.Name;
  frxReport1.DataSet := FSet;
  frxReport1.PrepareReport(false);
  frxReport1.ShowPreparedReport;
But that resulted in an access violation. When I try without the TDataSource, I get a 'Cannot find class TfrxDBDataset'.
What am I doing wrong?
Comments
and would be called by loading the previewpages.
frxreport1.previewpages.loadfromfile('pathand filename.fp3')
a report design file is saved and stored as a .fr3 file.
and would be called
frxreport1.loadfromfile('pathand filename.fr3');
frxreport1.showreport;