从 C# 代码导出参数化 SSRS 报告
目前我已经设置了 SQL Reporting Services 2005,报表管理器位于用户可以访问报表的 URL 上。这些报告在那里运作良好。
我的问题是尝试在 C# .net 4.0 代码中生成这些报告,无需任何用户交互(例如使用屏幕上的报告查看器)。我想在 C# .net 应用程序中生成报告并将其导出为 PDF 文件。报告具有必需的参数,因此我需要将参数传递给报告。我该怎么做?
我一直在网上搜索,要么我使用了错误的关键字,要么没有太多关于这方面的信息。我很惊讶找到这方面的信息是多么困难,因为我认为这是一个相当常见的问题。感谢任何和所有建议/帮助。
Currently I have SQL Reporting Services 2005 set up, with the report manager at a URL on which users can access reports. The reports are working great there.
My issue is trying to generate these reports in C# .net 4.0 code without any user interaction (such as using the report viewer on screen). I would like to generate and export a report to a PDF file in a C# .net application. The reports have required parameters so I would need to pass the parameters to the report. How can I do this?
I have been searching around online, and either I'm using the wrong keywords or there isn't much information on this. I am quite amazed at how difficult it has been to find information on this, as I would expect it to be a fairly common question. Any and all advice / help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我很少使用 2005 版的 ReportViewer。但您应该能够执行以下操作:
一般要点是
ServerReport
和LocalReport
都设计为可在 ReportViewer 之外使用。I've not used the 2005 version of the ReportViewer much. But you should be able to do something like this:
The general takeaway being that
ServerReport
andLocalReport
were both designed to be usable outside of a ReportViewer.我遇到了类似的问题,我想以 PDF 格式打开报告。如果您只需要在浏览器窗口中打开带有参数的 pdf,则可以使用报表服务器本身并指定 Format=PDF 作为查询字符串选项。
例子:
我希望这可以拯救其他人过段时间吧!
I had a similar issue where I wanted to open the report as a PDF. If you just need to open a pdf with parameters in a browser window then you can use the report server itself and specify Format=PDF as a querystring option.
Example:
I hope this saves someone else out there some time!