Report.ReportOut form = new Report.ReportOut();
form.BindingData = report =>
{
    #region BindingData
    ReportDataSource dataSource1 = new ReportDataSource("dsA", _reportA);
    ReportDataSource dataSource2 = new ReportDataSource("dsB", _reportB);
    ReportDataSource dataSource3 = new ReportDataSource("dsC", _reportC);
    ReportDataSource dataSource4 = new ReportDataSource("dsD", _reportD);
    ReportDataSource dataSource5 = new ReportDataSource("dsE", _reportE);
    ReportDataSource dataSource6 = new ReportDataSource("dsF", _reportF);
    ReportDataSource dataSource7 = new ReportDataSource("dsG", _reportG);
    ReportDataSource dataSource8 = new ReportDataSource("dsH", _reportH);
   
    report.LocalReport.ReportEmbeddedResource = "xx.Report.rdlc";
    report.Drillthrough += (a, b) =>
    {
        LocalReport re = (LocalReport)b.Report;
        if (re.ReportEmbeddedResource == "xx.ReportOut.rdlc")
        {
            #region ReportOut绑定报表数据
            re.DataSources.Add(dataSource1);
            re.DataSources.Add(dataSource2);
            re.DataSources.Add(dataSource3);
            re.DataSources.Add(dataSource8);
            #endregion
        }
        else if (re.ReportEmbeddedResource == "xx.ReportIn.rdlc")
        {
            #region ReportIn绑定报表数据
            re.DataSources.Add(dataSource1);
            re.DataSources.Add(dataSource2);
            re.DataSources.Add(dataSource3);
            re.DataSources.Add(dataSource4);
            re.DataSources.Add(dataSource5);
            re.SubreportProcessing += (x, y) =>
            {
                y.DataSources.Add(dataSource6);
                y.DataSources.Add(dataSource7);
            };
            #endregion
        }
    };
    report.LocalReport.EnableExternalImages = true;
    report.LocalReport.SetParameters(paraA);
    report.LocalReport.SetParameters(paraB);
    #endregion
};
form.Show();

报表设计,打开后第一个画面是Report.rdlc的页面,在这个页面里面有两个链接,这两个链接分别是打开ReportOut.rdlc和xx.ReportIn.rdlc的。报表实现多级分层,而且下级报表中嵌套两个子报表。

报表代码查询后台文件report.rar

相关文章:

  • 2021-10-30
  • 2021-11-10
  • 2021-08-01
  • 2021-07-11
  • 2021-06-16
  • 2021-12-12
  • 2021-06-25
  • 2021-11-17
猜你喜欢
  • 2022-02-26
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
相关资源
相似解决方案