Can I change the datsource of report model at runtime
I've some adhoc reports developed on some report models which are published on Report Server (we're using SSRS 2008). Everything is running well. Now in our production environment we've near about forty (40) customers who have their own database (each have the same table structures and other database objects). Now the challenge is whenever a customer will log into the report server using windows authentication and trying to view those reports we need to get the SQL data from the proper database only. Reports are designed using the report model and each model has a valid data source which is connected to particular database. We can create forty separate data sources each will be connected to specific database. My question is, is there any way through which we can change the report model data source name dynamica开发者_C百科lly or during runtime based on the customer name so that during execution of the report, SSRS would fetch the data from the correct database but not from any other database.
Please help me.
I don't think there is a way to specify at execution time a data source because the data source is part of the report definition (.rdl) and it has some security around it preventing a find-and-replace type method. However, there are functions available in the SSRS services (search for ReportingService2010.cs for an example) for us in .NET applications that allow you to set a data source. I know I've been on a project in the past where we deployed using an in-house created .NET application that uses these calls to set the data source on publish. This was for SSRS 2005.
On another project I've been on the method of choice is to publish using BIDS publish. We noticed that if you have the report already published out in an environment with a data source set that re-publishing using BIDS to the same location would retain the data source information (even if it were different than your development source). This was using SSRS 2008R2.
精彩评论