动态更改 Sql Reporting Services 2008 中的数据源
我想使用相同的 Reports(.rdl) 生成 24 个数据库的报告。
例如,如果我的报告(.rdl)中有一个用户表,那么报告(.rdl)的数据源应该动态更改。现在,我正在为 24 个数据库制作 24 份不同的报告。
我想要一个在运行时更改数据源的单个报告(.rdl)。
I want to use the same Reports(.rdl) to generate the reports for 24 databases.
For instance if there is a user table in my reports(.rdl), then the datasource for the report(.rdl) should change dynamically. Now, I'm making 24 different Reports for 24 databases.
I want a single report(.rdl) with the datasource changed at the runtime.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实现此目的的方法可以是向报告 (.rdl) 文件添加 3 个参数
以及如果需要
然后更改数据源的连接字符串,例如
此方法唯一的小问题是参数名称在 URI 中可见,因此买者自负。
The way to achieve this could be adding 3 parameters to your report (.rdl) file
and if required
Then change the connection string for the datasource like
Only small issue with this approach is the paramnames are visible in the URI so caveat emptor
我找到了解决我的问题的替代方案。我创建了一个(.rdl)报告文件,该文件使用在所有数据库中拥有权限的用户作为该用户提供数据源,以及我在数据库中创建单个过程的数据库,假设管理数据库(用于所有过程对所有人来说都很常见),在该过程中,我执行了其他数据库中存在的过程,如下所示:
其中用户名和数据库名称存在于表中(对于所有数据库)以及列名sentDate,该列名在之后更新为今天的日期执行该数据库名称的过程,以便执行该过程后,数据源移动到用户名和数据库名之后的下一个。并使订阅在 10 分钟后运行,以便它可以通过每次执行时从不同数据库获取数据来发送所有数据库的报告。
I found an alternative solution to my problem. I created a single (.rdl) Report file which used the user which had a right in all the databases gave the datasource as this user, and the database as in which I made single procedure in a database, suppose admin database(used for all procedure which are common to all), In that procedure I executed the procedure which is present in other databases like this:
where username and Databasename are present in the table(for all database) and a column name sentDate which is update to todays date after executing the procedure for that databaseName, so that the datasource moves to next after username and databasename after executing the procedure. And made the subscription to run after 10 min, so that it can send the reports of all databases, by getting data form different database in each execution.