c# - 以编程方式将数据源绑定(bind)到报表服务器中的 rdl - SSRS

标签 c# asp.net sql-server reporting-services

我已经完成了一个 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/

相关文章:

asp.net - LINQ:无法在具有唯一索引的对象 'dbo.tblOutstandingCompletions' 中插入重复的键行

c# - 使用 UWP TextBox.TextChanging 忽略错误数据

c# - 带参数启动线程

asp.net - AD LDS w/ASP.NET 表单例份验证

sql - 仅选择 Varchar 列中的数字

c# - 将通用列表 C# 批量插入 SQL Server

c# - .NET 词典具有相同的键和值,但不是 "equal"

javascript - C# 如何在静态Web方法中获取asp.net文本框值?

c# - PayPal 集成 (IPN) - 真的有可能吗?

mysql - 如何在 visual studio 2015 中使用 ADO.net Identity 数据模型使用 Entity Framework 6(web api)进行 mariadb 设置(版本 10.2.17)?