I am looking for a method of changing the data source for a report in SQL Server Reporting Services.
我正在寻找一种方法来更改SQL Server Reporting Services中的报表的数据源。
Basically what functionality I am looking for is a drop down box (parameter) at the top of the report that permits the user of the report to select a different data source to run the report against (so when the drop down selection is changed and view report is clicked it runs the same report but against a different data source).
基本上我正在寻找的功能是报表顶部的下拉框(参数),允许报表用户选择不同的数据源来运行报表(因此当下拉选项更改并查看时单击报告它会运行相同的报告,但针对不同的数据源)。
Is there any way to do this?
有没有办法做到这一点?
1 个解决方案
#1
3
If you're referring to the SQL Server Reporting Services then you can only have one data source (either local to the report or shared). You have to get tricky, like having a stored procedure return different sets of data based on a parameter which can be linked to a drop down on the report.
如果您指的是SQL Server Reporting Services,那么您只能拥有一个数据源(报表的本地数据源或共享数据源)。您必须变得棘手,例如让存储过程根据参数返回不同的数据集,该参数可以链接到报表上的下拉列表。
See (SQL 2000 links, not sure what version you're using):
请参阅(SQL 2000链接,不确定您使用的是哪个版本):
- Defining Report Data
- Using Dynamic Queries
定义报告数据
使用动态查询
If on the other hand you're happy to use the (IMHO much more flexible) Report Viewer control (either the Web or WinForms version) then you can represent any UI you like and generate any data you like based on user interation and simply get the viewer to render the output for you using the same engine. The big difference is that all the work is done by the client (which for a web app is your web server instead of your database server).
另一方面,如果你很高兴使用(恕我直言更灵活)Report Viewer控件(Web或WinForms版本),那么你可以表示你喜欢的任何UI,并根据用户的交互生成你喜欢的任何数据,然后简单地得到查看器使用相同的引擎为您呈现输出。最大的区别在于所有工作都是由客户端完成的(对于Web应用程序而言,它是您的Web服务器而不是数据库服务器)。
See:
#1
3
If you're referring to the SQL Server Reporting Services then you can only have one data source (either local to the report or shared). You have to get tricky, like having a stored procedure return different sets of data based on a parameter which can be linked to a drop down on the report.
如果您指的是SQL Server Reporting Services,那么您只能拥有一个数据源(报表的本地数据源或共享数据源)。您必须变得棘手,例如让存储过程根据参数返回不同的数据集,该参数可以链接到报表上的下拉列表。
See (SQL 2000 links, not sure what version you're using):
请参阅(SQL 2000链接,不确定您使用的是哪个版本):
- Defining Report Data
- Using Dynamic Queries
定义报告数据
使用动态查询
If on the other hand you're happy to use the (IMHO much more flexible) Report Viewer control (either the Web or WinForms version) then you can represent any UI you like and generate any data you like based on user interation and simply get the viewer to render the output for you using the same engine. The big difference is that all the work is done by the client (which for a web app is your web server instead of your database server).
另一方面,如果你很高兴使用(恕我直言更灵活)Report Viewer控件(Web或WinForms版本),那么你可以表示你喜欢的任何UI,并根据用户的交互生成你喜欢的任何数据,然后简单地得到查看器使用相同的引擎为您呈现输出。最大的区别在于所有工作都是由客户端完成的(对于Web应用程序而言,它是您的Web服务器而不是数据库服务器)。
See: