简体   繁体   English

ASP.NET MVC将URL中的ID传递给SSRS参数以执行报告

[英]ASP.NET MVC Pass the ID in URL to SSRS parameter to execute the report

I am trying to do a SSRS report for a .NET application. 我正在尝试为.NET应用程序编写SSRS报告。 I have everything running in the SSRS part but my query has a parameter because the report has a different id for each report. 我在SSRS部分中运行了所有程序,但是我的查询中有一个参数,因为该报表的每个报表都有不同的ID。

Imagine I click on a user that I want a report about, that user has the id = 2 the parameter in my SSRS gets the id then executes the query depending on the id. 想象一下,我单击一个我想要报告的用户,该用户的id = 2,我的SSRS中的参数获取ID,然后根据ID执行查询。

How can I export the id to the SSRS query from the web page ? 如何从网页将ID导出到SSRS查询?

I have implemented this in the past using SSRS 2012. 我过去使用SSRS 2012实现了此功能。

When using the SSRS server's web report viewer ( ReportViewer.aspx page) to display the report to the user in their browser, you can pass values for report's parameters by including them in the query string part of the URL in the format ParameterName=value . 当使用SSRS服务器的Web报表查看器( ReportViewer.aspx页)在用户的浏览器中向用户显示报表时,可以通过以ParameterName=value格式将其包含在URL的查询字符串部分中来传递报表参数的ParameterName=value

For example, to pass the value 2 to a parmeter called UserID, append &UserID=2 to the report URL. 例如,要将值2传递给名为UserID的参数,请将&UserID=2附加到报告URL。

The parameter name is case sensitive if I remember correctly. 如果我没记错的话,参数名称区分大小写。

As an extra, if you just want to render the report and don't need the user to see or be able to change the parameters on the report viewer page then you can also add &rc:Parameters=false to the URL. 另外,如果您只想呈现报表而无需用户查看或能够更改报表查看器页面上的参数,则还可以在URL中添加&rc:Parameters=false

An example URL would then look something like: http://MySSRSServer/ReportServer/Pages/ReportViewer.aspx?/ReportPath&UserID=2&rc:Parameters=false 然后,示例URL类似于: http://MySSRSServer/ReportServer/Pages/ReportViewer.aspx?/ReportPath&UserID=2&rc:Parameters=false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM