将参数从 ReportViewer 传递到 SSRS 报告的存储过程数据源
我正在 SSRS 2008 R2 的 BIDS 中开发一份报告,该报告使用存储过程作为其数据源。我已经在报告中设置了参数,并且报告将它们传递给存储过程,一切正常。但是,我现在需要转换报表,以便它获取从 C# ASP.Net 应用程序中的 ReportViewer 控件传递给它的参数,而不是允许它们在 SSRS 界面中输入。我认为我在 C# 方面很好(使用 ServerReport.SetParameters),但我不知道在 BIDS 中该怎么做才能将这些传入的参数值路由到存储过程。谁能提供一个例子吗?
我还需要阻止报告显示用于输入参数的 UI。我应该将参数设置为“隐藏”还是“内部”?
I have a report I am developing in BIDS for SSRS 2008 R2 that uses a stored procedure as its data source. I have set up parameters in the report and the report is passing them on to the stored procedure and everything works fine. However, I now need to convert the report so it gets its parameters passed to it from a ReportViewer control in a C# ASP.Net application instead of allowing them to be entered in the SSRS interface. I think I am fine on the C# side (using ServerReport.SetParameters), but I don't know what to do in BIDS to route those passed-in parameter values to the stored procedure. Can anyone provide an example?
I also need to prevent the report from displaying the UI for entering the parameters. Should I set the parameters to Hidden or Internal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会将报告参数设置为“内部”,但请阅读本文 http://msdn .microsoft.com/en-us/library/aa337234.aspx 部分隐藏和内部参数,并自行决定什么适合该问题。
假设您有一个存储过程,例如
在 SSRS 中定义 2 个报告参数(InputText 作为字符串,RepeatFactor 作为整数)。然后,在你的 SSRS 中,你的数据集将被定义为
然后在数据集的“参数”选项卡上,它看起来像
为了解决方案的完整性,这是我用来将参数传递到 ID 为 rvReportViewer 的报表控件的代码的近似值
I would set the report parameters as Internal but read up on this article http://msdn.microsoft.com/en-us/library/aa337234.aspx for the section Hidden and Internal Parameters and decided for yourself what is appropriate to the problem.
Assuming you have a stored proc like
Define 2 report parameters in SSRS (InputText as string, RepeatFactor as integer). Then, in your SSRS, your dataset would be defined like
And then on the Parameters tab of the dataset, it would look like
For completeness of solution, this is an approximation of the code I use to pass parameters in to a report control with an ID of rvReportViewer