本文介绍了如何在C#中的单个报表查看器中显示报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在单个报告查看器中显示多个报告。



我尝试过:



我用这个

I want to display multiple reports in single report viewer.

What I have tried:

I have use this

if(combobox.seletedindex == 0)
{
reportViewer1.LocalReport.SetParameters(reportParameter);
                ReportDataSource rd = new ReportDataSource("",dt);

                reportViewer1.LocalReport.ReportEmbeddedResource ="GenerateReport.rdlc";
                reportViewer1.RefreshReport();
}
else
{
same code for next report..........
}

推荐答案


if(...)
{
reportViewer1.LocalReport.ReportPath = "GenerateReport1.rdlc";
reportViewer1.LocalReport.SetParameters(reportParameter);
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rd = new ReportDataSource("DataSet1", datasource1);
reportViewer1.LocalReport.DataSources.Add(rd);
}
else
{
reportViewer1.LocalReport.ReportPath = "GenerateReport2.rdlc";
reportViewer1.LocalReport.SetParameters(reportParameter);
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rd = new ReportDataSource("DataSet2", datasource2);
reportViewer1.LocalReport.DataSources.Add(rd);
}
......


这篇关于如何在C#中的单个报表查看器中显示报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 23:52