Skip to Content
0
Former Member
Aug 11, 2009 at 07:04 PM

Missing Parameter Values while using Change SubReport links

26 Views

Hi,

I am using Change SubReport Links to pass data from Main Report to the SubReport. The report works fine at design time when I preview it, but at runtime I get "Missing Parameter Values" error.

As I have used Chanage SubReport Links do I still need to pass the parameter to the SubReport from the code.

cr.Export gives this error.

Below is the code

ExportOptions crExportOptions;

DiskFileDestinationOptions crDiskFileDestinationOptions;

string Fname = string.Empty;

string strReportName = string.Empty;

ReportDocument cr = new ReportDocument();

string strReportPath = Request.PhysicalApplicationPath.ToString() + @"Members\Reports\UnPaidReceipt.rpt";

if (!System.IO.File.Exists(strReportPath))

{

throw (new Exception("Unable to locate report file:\n" + strReportPath));

}

cr.Load(strReportPath);

MtollBLL Unpaid = new MtollBLL();

cr.SetDataSource(Unpaid.GetUnpaidPayments().DefaultView.Table);

// Set the Crytal Report Viewer control's source to the report document.

CrystalReportViewer1.ReportSource = cr;

MtollBLL Violation= new MtollBLL();

cr.Subreports[0].SetDataSource(Violation.GetReportViolation().DefaultView.Table);

// cr.PrintToPrinter(1, False, 0, 0)

Response.Write( cr.Subreports[0].DataDefinition.ParameterFields.Count);

Fname = Request.PhysicalApplicationPath.ToString() + Session.SessionID.ToString() + ".pdf";

crDiskFileDestinationOptions = new DiskFileDestinationOptions();

crDiskFileDestinationOptions.DiskFileName = Fname;

crExportOptions = cr.ExportOptions;

crExportOptions.DestinationOptions = crDiskFileDestinationOptions;

crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

cr.VerifyDatabase();

cr.Subreports[0].VerifyDatabase();

cr.Export();//' The following code writes the pdf file to the Clientu2019s browser

Please Advise.