This is a migrated thread and some comments may be shown as answers.

Connection String

1 Answer 143 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Surya
Top achievements
Rank 1
Surya asked on 11 Sep 2012, 05:20 PM
We have an ASP.NET AJAX application that uses Telerik Components including Telerik Reporting. We have three distinct environments viz., Development, Staging and Production. We currently have connection strings for each of these environments in Web.Config and have a setting that indicates which environment we are currently in. Depending on the environment setting, we use the appropriate connection strings.

When it comes to Telerik Reporting, we are setting the connection string of the report designer to use the application connection string of a specific environment. However, when moving the application to a different environment say for example 'Production' we have to go into each of the those reports and point all the datasources to use the connection string pertaining to 'Production'.

Is there any better way to handle this instead of changing it in every single report and for every deployment to a different environment?

Appreciate your input and help...

1 Answer, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 17 Sep 2012, 08:56 AM
Hello Surya,

In your case it seems that you can easily use named connection strings and for each environment to have the same named connection string with a different value. Whenever you change the option from Staging to Production for example in the solution configurations drop down, the connection string will be automatically picked from your Web.Production.config file.

If for some reason you cannot do this you can assign the connection string of each datasource using a parameter, like this:
this.sqlDataSource1.ConnectionString = "Data Source=" + myDataSource + ";Initial Catalog=AdventureWorks;Integrated Security=SSPI";

It will be best if you place this code snippet in the constructor of your report.

Regards,
IvanY
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Surya
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Share this question
or