Change connection string of datasource on build for SSRS Project - reporting-services

I have a few SSRS projects and when I publish the projects, I have to manually go back to Reporting Services and change back the connection string to the correct server.
Is there a way to automate this? Can I change the connection string on build (before publish) base on my configuration?

I have to assume a few things here..
Your Report has a Datasource called something like Datasource_dev
You are attempting to deploy to different environments that have different datasources like Datasource_test and Datasource_Prod?
If the above conditions are true, then you simply have to set the correct datasource once on each of the servers you are deploying to ie, the first time you deploy the report.
You will also need to set the setting below (in properties of your SSRS project) to
OverwriteDataSources=false
Then all subsequent deployments will retain the datasource that was set manually.
Couple of things to Note.
Make sure you change the setting for all configurations you have (debug,release etc)
If you ever delete the report from the server, you'll have to reset the datasource again

Not sure if there's a way to fully automate it. But did you try to just create a Data source? Then just edit the Data Source connection of the report under Manage? In that way you don't have to go back to SSRS when you will just edit the connection of the report.

Related

Why did deploying a single report also overwrite the data source?

We had a problem earlier when deploying a single report to the production environment, when, for reasons we don't understand, SSRS decided to also overwrite the Data Source associated with the report with settings that do not even match those currently in the project.
We want to understand why/how this happens, and what we need to be doing to control it - ie, what are we missing about SSRS that we need to be aware of.
The steps we took were as follows:
Before starting: This is to update an existing report, not a new report, so the Prod report server already has the Data Source and the (old) Report Definition. The Data Source (shared) does not need to be changed at all, nor do we believe we did anything that should have prompted SSRS to do so. We only intended to overwrite the old report definition with the new one.
Data Source within project modified to point to the production Sql Server source
Deployment settings within the project modified to point to the production Report Server
The single report deployed (literally by right-clicking TheReport.rdl in the Solution Explorer and then clicking Deploy). That is everything we did. We did not deploy or change anything else.
Expected result: report definition on the prod server overwritten with the new report. Data Source completely unchanged, because why would it be? We didn't deploy that (and in any case, the one in the project is pointing to prod, so it shouldn't even matter if it did)
Actual result: Report overwritten as expected. Data Source also overwritten... with the old dev settings. Not the ones currently in the project. All the other reports sharing this data source suddenly stop working or display dev server data.
What are we doing wrong? SSRS quietly overwriting the associated Data Source on the server when deploying a single report seems dangerous (we would likely have missed that it had even happened, had the data on these particular dev and live environments been similar enough) so I presume we are missing something we should be doing/checking when deploying reports, but are at a loss as to exactly what.
That is configuration to copy your datasources and datasets to the report portal or not. You can change the configuration by right click on your report project and select properties that will open up the property pages. There is an option to overwrite default settings. Please check below image for more details
By using the above configuration it will deploy dataset and data sources on SSRS server only if it is not exists on the server.
Hope this will work.

SSRS - data source issue

I'm looking at some issues with a migration of a huge amount of rdl's, the guy that has done this has shifted them and they work, so that's good.
But... if I download one of them the datasource is still the original datasource not the one he changed it to using the web interface.
If I download it, its the old db connection. If I view via the web interface it shows the correct datasource, and then... if I right click and edit through report builder (via the web interface) it shows the updated datasource.
If I save it updates it as I would expect.
Am I missing something here?
Personally, I would never edit a report via the web thing, I would always edit the file and redeploy.
Is there some way I can republish them all without opening each one and saving (I'm 85 into 450 of them and am bored shitless!)
This is both a question and a possible answer. Have you restarted your instance of SSRS? If the data source is shared, and has been modified, you shouldn't have to open the reports in the builder for them to reflect the modification, so alternatively it sounds like the connections are cached and a restart should clear that up.

How can I add an embedded data source to RDL in C# code?

I am trying to use SSRS in a multi-tenant situation. The base version we want to support is SQL Server 2008 but if R2 is needed we might be ok with that.
I am currently using the ReportingService2005.asmx endpoint which seems to expose the ReportService2005SoapClient class (even though all samples seem to show ReportingService2005 class).
When we run a report I want to make a copy of that report from the server, add an embedded datasource, point the datasets to that datasource and then run the report.
I have gotten as far as:
getting the RDL from the server
modifying the XML to add the DataSource
pointing the datasets to point to the new datasource
...but when I try to "CreateReport" I get the following error:
System.Web.Services.Protocols.SoapException: The dataset ‘DataSet1’ refers to the data source “mydatasource_LOCAL”, which does not exist.
at Microsoft.ReportingServices.Library.ReportingService2005Impl.ExecuteBatch(Guid batchId)
at Microsoft.ReportingServices.WebServer.ReportingService2005.ExecuteBatch()
I have added the dataset to the RDL, it looks the same as when I add one in the designer. However, I assume something needs to be added to the server? What am I missing?
(As an aside, I know MS Dynamics enabled multi-tennant SSRS in a single instance, but I see no info on how they did it. If they have any code or anything they share someone could point me to that would be awesome.)
You're using the correct endpoint, more or less. From MSDN:
The ReportService2005 and ReportService2006 endpoints are deprecated in SQL Server 2008 R2. The ReportService2010 endpoint includes the functionalities of both endpoints and contains additional management features.
In any case, you mention you modify the RDL to use a new data source in step 2. I might be wrong, but I think you probably still need to add a DataSource item to your report catalog using the ReportingService2010 CreateDataSource(...) method.
If you deploy a new report from Visual Studio to report server it wil also mention in the log that it's deploying the data source before it deploys the report.
Of course you could also create that data source on the server beforehand, using the report manager (though "mydatasource_LOCAL" may not be an ideal name).

SQL Server Reporting Services(SSRS) Dynamic Data Souce

I'm a very new user to SSRS. I learned the basic things and am able to make reports using VS 2008 and BIDS. But I can't move further. I want to use the dynamic data source. My issues are:
First the user should input four credentials: a)Server name b) database name c) user id 4) password. It will help to make the connection with database and make the data source. The credential should be stored in session or cookie.
Now the user will be able to see all the reports without giving the credential because he/she has already given them.
I made a dynamic data source but the credentials are asked for every time I open a report.
Any demo project or an articles will be highly appreciated.
It sounds like SSRS alone will not accomplish what you want. SSRS will not provide a good interface for end users to create new datasources, or change existing datasources. There are some potential workarounds that get some of the functionality you desire, such as a method to change servers found at:
http://blog.softartisans.com/2011/04/19/how-to-create-a-dynamic-reporting-services-shared-data-source-using-linked-servers/
(requires the ability to use linked servers.)
But to manage the user session or cookies, you will need more than SSRS. The easiest way to get at this will be with a .NET web site to manage the credentials. It might be able to use a ReportViewer control, or other method of accessing SSRS, such as URL access, to get reporting functionality.

Reporting Services - deployment and global/shared configuration between reports

Is it possible to add global variables that are shared among reports in SQL Server Reporting Services? I know it's possible to add variables for a report but I want the same variables to be used from many different reports.
Also, is it possible to have different configurations for different servers so that when reports are deployed they will use different settings? (like web.config for SSRS reports). The purpose is to have different settings for development, test and production environments. They way it is now, I have to change variables in the report properties before deployment.
(of course its possible to create a table in the database for report settings but I really don't want to mess up vendor databases or add new databases just for adding global report configuration)
You might want to look into using custom assemblies
http://www.code-magazine.com/article.aspx?quickid=0701061&page=2
Personnally I use parameters for code purpose, but you can define these into the web interface.
When you ask the web service http://127.0.0.1:80/ReportServer/, just add the parameter like a get url, &param1=toto&param2=1986-09-29 12:30&param3=1
And you can also use a shared datasource, connectstring will be into a single file.
I recommend you also to use RssScripter http://www.sqldbatips.com/showarticle.asp?ID=62 in order to script the deploy.
Regards,