【发布时间】:2016-06-24 15:12:45
【问题描述】:
我的报告有问题,但奇怪的是它仅在生产环境中不起作用,如果我在本地 IIS 上部署我的解决方案或在使用 VS2013 的调试阶段,我可以看到带有正确填充子报告的报告。
我正在使用 VS2013 和 ReportViewer2012。
所以,在开发和测试环境中一切正常,但在生产中,当我调用打印时,会出现“子报表的数据检索失败......(对于所有子报表)”。 为什么?
所以,我有一个报告容器,里面有一些子报告,还有一些代码:
来源
loadDataSources(); //loading all datatables of subreports
ReportViewer ReportViewer1 = new ReportViewer();
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.Visible = false;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/ReportContainer.rdlc");
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet0", _datatableContainer));
ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
CreatePDF(ReportViewer1, uniquefilename);
void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
if (e.ReportPath.ToLower() == "rpt_sub_1")
{
e.DataSources.Add(new ReportDataSource("DataSet1", _datatable1));
e.DataSources.Add(new ReportDataSource("DataSet2", _datatable2));
e.DataSources.Add(new ReportDataSource("DataSet3", _datatable3));
}
if (e.ReportPath.ToLower() == "rpt_sub_2")
{
e.DataSources.Add(new ReportDataSource("DataSet4", _datatable4));
e.DataSources.Add(new ReportDataSource("DataSet5", _datatable5));
e.DataSources.Add(new ReportDataSource("DataSet6", _datatable6));
e.DataSources.Add(new ReportDataSource("DataSet7", _datatable7));
}
//...
非常感谢
【问题讨论】:
标签: asp.net-mvc reporting rdlc reportviewer