在我的rdlc报告中,我创建了参数测试。在表单中我写下代码来设置参数:
//Set Parameters
ReportParameter[] p = new ReportParameter[1];
p[0] = new ReportParameter("Test", "Testing");
currentBilling_rv.LocalReport.SetParameters(p);
// Provide datasource to report Current_Total_Billing.rdlc
ReportDataSource rds = new ReportDataSource("CurrentTotalBilling", dataset.Tables[2]);
currentTotalBilling_rv.LocalReport.DataSources.Clear();
currentTotalBilling_rv.LocalReport.DisplayName = "Current Total Billing";
currentTotalBilling_rv.LocalReport.ReportPath = ".\\Current_Total_Billing.rdlc";
currentTotalBilling_rv.LocalReport.DataSources.Add(rds);
currentTotalBilling_rv.RefreshReport();
当我运行程序时,我有异常
Microsoft.ReportViewer.WinForms.dll中发生未处理的“Microsoft.Reporting.WinForms.MissingReportSourceException”类型异常
附加信息:尚未指定报告定义的来源
请帮忙。
在您的代码中,您正在为名为ReportViewer
的currentBilling_rv
设置一个参数,而不是为currentTotalBilling_rv
设置参数,该参数在下一行代码中使用。
如果currentBilling_rv
名称正确,请验证currentBilling_rv.LocalReport.ReportPath
是否已编译。