我已经完成了一个 ASP.NET 应用程序来生成特定数据的报告。最初,我创建了本地报告(.rdlc)来生成报告。我为每个 rdlc 创建了单独的 .xsd 并设计了报告。我以编程方式构建数据集并将其绑定到 rdlc。我使用以下代码将数据源绑定到报告 -
rptMyReport.LocalReport.ReportPath = Server.MapPath(srdlcName);
rptMyReport.LocalReport.DataSources.Add(rds);
现在我已将所有 rdlc 转换为 rdl 以下这篇 MSDN 文章我已将报告发布到报告服务器。
rptMyReport.ServerReport.ReportServerUrl = new System.Uri("http://ReportServer/ReportServer");
rptMyReport.ServerReport.ReportPath = "/ReportFolder/ReportName";
现在我如何以编程方式将数据源设置为报告?
这项工作是不可能的。您应该在 rdl 报告中创建数据源。您必须编写报告数据收集所需的查询。您可以将此查询用作文本或存储过程。您可以将参数传递给该查询并过滤查询的输出。
您只能将参数传递给 rdl 报告,如下所示:
ReportParameter[] Params = new ReportParameter[1];
Params[0] = "Parameter Value";
ReportViewerControl.ServerReport.SetParameters(Params);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)