我已经完成了一个 ASP.NET 应用程序来生成特定数据的报告。最初,我创建了本地报告(.rdlc)来生成报告。我为每个 rdlc 创建了单独的 .xsd 并设计了报告。我以编程方式构建数据集并将其绑定(bind)到 rdlc。我使用以下代码将数据源绑定(bind)到报告 -
rptMyReport.LocalReport.ReportPath = Server.MapPath(srdlcName);
rptMyReport.LocalReport.DataSources.Add(rds);
现在我已经将 this msdn article 之后的所有 rdlc 转换为 rdl我已将报告发布到报告服务器。
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);
关于c# - 以编程方式将数据源绑定(bind)到报表服务器中的 rdl - SSRS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2360992/