2012-03-03 73 views
3

我有一个情况在这里,我使用的SSRS报告,即时通讯发送4个参数。对我来说,报告工作正常。现在出现的另一个问题是,客户需要在同一个报表查看器中逐页查看多个报表(单击下一页)。如何将多个报告添加到相同的ReportViewer?

我使用程序发送参数?我如何实现这一目标?

ReportViewer1.ServerReport.ReportServerCredentials = new ReportViewerCredentials(UserName, Password, Domain); 
ReportViewer1.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationManager.AppSettings["ReportServerURL"].ToString()); // Report Server URL 

string strUrl = string.Empty; 
strUrl = WebConfigurationManager.AppSettings["ReportAppName"].ToString() + "/" + ReportName.Trim(); 
ReportViewer1.ServerReport.ReportPath = "/" + strUrl; 

ReportViewer1.ShowParameterPrompts = true; 
ReportViewer1.ShowPrintButton = true; 
ReportViewer1.ShowExportControls = true; 

ReportParameter[] reportParameters = new ReportParameter[4]; 
reportParameters[0] = new ReportParameter("AccountNo", AccNo, false); 
reportParameters[1] = new ReportParameter("ServiceCode", sType, false); 
reportParameters[2] = new ReportParameter("BillMonth", Month, false); 
reportParameters[3] = new ReportParameter("BillYear", Year, false); 

ReportViewer1.ServerReport.SetParameters(reportParameters); 
ReportViewer1.ServerReport.Refresh(); 

在上面的应用程序中,你可以看到我发送4个参数到它。该应用程序适用于单一帐号。我的新要求是,我将有多个帐号,我需要从中检索数据。在报告中,我应该只显示一个帐号的数据。

我需要在其他报告中显示其余的页面,因此当用户点击它时,他/她可以浏览它。是否有可能实现这一目标?我如何将它显示为页面?

请帮我解决这个问题。

因此,如果我可以在同一份报告中看到这个页面,我们可以将它下载到单个文件中。

+0

@smilu;嗨,你是否能够实现多个报告要求?我有这个确切的要求。谢谢。 – 2012-06-21 05:58:00

+0

至今没有.. :( – smilu 2012-08-08 07:20:41

+0

该死的,我也有同样的问题。你解决呢? – Seva 2014-05-21 20:11:41

回答

0

要将多个报告添加到一个报告中,请在查询中执行联合并使用列作为数据所属的报告的标识符。如果列号类型和名称不匹配,则必须使用填充信息,因为联合不起作用。

既然您已将所有数据用于报表设计器,以将新报表数据分配到新页面。希望这有帮助

+0

你能否更详细地解释这一点。我明白凭着它正确 – smilu 2012-03-10 07:52:05

1

对于你的sql查询,将原始数据填充到报表中,进行两个单独的查询,然后将结果合并到一个返回集中。

select customer, address, balance, "customer" as Table from customer where balance > 0 

union all 

select products as customer, price as balance, "products" as Table from products 

假设您知道需要哪些产品系列产品。现在您拥有原始数据。报表设计器中将有多个表格。根据表名过滤告诉哪些数据转到哪个表。

+0

好吧,当我们做UNION我们会得到所有这些不同不同的行,现在我只需要显示每页一行,即如果我有20行,报告应该分成20页。 – smilu 2012-03-13 06:38:09