Skip to Content
0
Former Member
Aug 25, 2009 at 02:01 AM

subreport parameters

48 Views

I can't get the sub-report to display data when printing from my C# code.

I have a main report with a sub-report. The main report has two parameters, one that is linked to the subreport. When I view the report in the editor or stand-alone Crystal Reprots the sub-report populates correctly, passing the linked parameter to the subreport.

When I print the report in code, nothing shows in the sub-report. I tried setting the parameter in the sub-report but recieved an error. I am using CR Developer 2008, Full version, 12.0.0.683, with Visual Studio 2008 (c# & WPF). I just purchased this version of CR and have not found any updates or hot fixes.

Here is the code:

CrystalDecisions.CrystalReports.Engine.ReportDocument report

= new CrystalDecisions.CrystalReports.Engine.ReportDocument();

report.Load("C:
Reports
UnitStatus.rpt");

report.Refresh();

report.SetDatabaseLogon("", "", "", ""); //(i removed these values)

report.SetParameterValue(0, true);

report.SetParameterValue(1,"B" );

report.PrintToPrinter(1, false, 1, 1)

Thanks for any help.