Loading .fr3 that includes datasets
Hi all,
I've designed a report on a form, that included two TfrxDBDatasets (one linked to the report page, and one to a master data band). That previews fine.
I'm now trying to put it all into a class that loads the saved .fr3 file and I'm having trouble with the datasets. I'm creating TClientDataSets, then creating TfrxDBDatasets and linking them to their TClientDataSet, and giving them the same Username as was saved in the .fr3 file.
But it gives me an exception "Cannot find class TfrxDBDataset" when preparing the report. I'm setting all the memo field datasets too. I feel like I'm doing something wrong.
Does anyone have some sample code that works?
Many thanks.
I've designed a report on a form, that included two TfrxDBDatasets (one linked to the report page, and one to a master data band). That previews fine.
I'm now trying to put it all into a class that loads the saved .fr3 file and I'm having trouble with the datasets. I'm creating TClientDataSets, then creating TfrxDBDatasets and linking them to their TClientDataSet, and giving them the same Username as was saved in the .fr3 file.
But it gives me an exception "Cannot find class TfrxDBDataset" when preparing the report. I'm setting all the memo field datasets too. I feel like I'm doing something wrong.
Does anyone have some sample code that works?
Many thanks.
Comments
I can't find FRDemo on my system. I'm using FastReports 5 that came loaded with Delphi XE8.
Do you have example code for a console application that loads a '.fr3' file, and uses TfrxDBDataset?
If after loading a .fr3 file it references any TfrxDBDataset components - it will fail unless the TfrxDBDataset component was created at design-time. Creating the TfrxDBDataset at runtime causes TfrxReport.PrepareReport to raise an exception saying it cannot find the TfrxDBDataset component.
I noticed that after loading the .fr3 file, TfrxReport.Datasets[0].Dataset is nil, whereas during tests where everything is created at design-time, that property references the TfrxDBDataset component. All my attempts to fix this property reference result in AV exceptions, including using TFrxReport.Datasets.Add.
If you could post a working sample of a console application, that would solve all my problems.
Thank you.
Something that I thought was important, was actually the cause of the problem.
Setting TfrxDBDataset.Parent to anything causes the error about not being able to find the dataset.
So, it works by creating the TfrxReport object, creating the dataset (eg TADOQuery), creating the TfrxDBDataset, setting the UserName property to what the .fr3 file specifies, and away it goes.