在RDLC中调用子报告 [英] Calling Sub Report in RDLC

查看:88
本文介绍了在RDLC中调用子报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码遇到了一个奇怪的问题。我有报告在其中有子报告。子报告的代码在本地工作正常。但是在生产服务器上部署之后不一样。下面是我加载报告的代码。



我得到的错误是





数据检索子报告ItinerarySummary失败,位于:E:\ Pububing \V 1.0 \Reports\Sales\ItinerarySummary.rdlc。请查看日志文件以获取更多信息。



任何帮助将不胜感激。





 受保护  void  LoadReport( ReportDataSource rptSource, string  ReportFileName,List< ReportParameter> Param =  null 
{
if (ReportViewer1.LocalReport.DataSources.Count > 0
{
ReportViewer1.LocalReport.DataSources.RemoveAt( 0 );
}

ReportViewer1.LocalReport.DataSources.Add(rptSource);
ReportViewer1.LocalReport.ReportPath = Server.MapPath(ReportFileName);

if (Param!= null
{
ReportViewer1.LocalReport.SetParameters(Param);
}
ReportViewer1.LocalReport.SubreportProcessing + = new SubreportProcessingEventHandler(localReport_SubreportProcessing);
ReportViewer1.LocalReport.Refresh();
}


void localReport_SubreportProcessing( object sender ,SubreportProcessingEventArgs e)
{
e.DataSources.Add( new ReportDataSource( PricingHeader,TourPricingDAL.getTourPricingDetails( null ,TourLaunchDetailsID)));
}

解决方案

我通过在同一报告中添加多个数据集而不是多个子报告解决了这个问题! !!!

I am having a strange problem with my code. I have report having sub report in it. The code for sub report is working fine locally. But the same is not after deploying on Production Server. Below is my code for loading report.

Error I am getting is


Data retrieval failed for the subreport, 'ItinerarySummary', located at: E:\Publish\V 1.0\Reports\Sales\ItinerarySummary.rdlc. Please check the log files for more information.

Any help would be greatly appreciated.


protected void LoadReport(ReportDataSource rptSource, string ReportFileName, List<ReportParameter> Param = null)
    {
        if (ReportViewer1.LocalReport.DataSources.Count > 0)
        {
            ReportViewer1.LocalReport.DataSources.RemoveAt(0);
        }

        ReportViewer1.LocalReport.DataSources.Add(rptSource);
        ReportViewer1.LocalReport.ReportPath = Server.MapPath(ReportFileName);

        if (Param != null)
        {
            ReportViewer1.LocalReport.SetParameters(Param);
        }
        ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(localReport_SubreportProcessing);
        ReportViewer1.LocalReport.Refresh();
    }


void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
    {
            e.DataSources.Add(new ReportDataSource("PricingHeader", TourPricingDAL.getTourPricingDetails(null, TourLaunchDetailsID)));
    }

解决方案

I have solved this issue by adding multiple datasets in the the same report instead of having multiple sub reports!!!!


这篇关于在RDLC中调用子报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆