Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.Net Connection String

Posted on 2014-02-04
3
Medium Priority
?
347 Views
Last Modified: 2014-03-05
I have a connection string in asp.net that controls a drop down in a Grid View. Based on the server that I am on either in Test, QA or Production the Database Instance names are different.

I want to be able to have the Connection String change v/s being hard coded. I tried a Session String but it doesn't like it;

Here is the base of what I have:

<asp:SqlDataSource ID="SQLConnection" runat="server"
   ConnectionString = "<%$ ConnectionStrings:DBConfig %>"
   SelectCommand = "SELECT Name FROM TableName "></asp:SqlDataSource>

What I want is to be able to replace the DBConfig with something dynamic that will distinguish the different instance names that it looks at in the web.config based on the server name.

Thanks
0
Comment
Question by:jeffreyjseaman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 39833331
If you are using Visual Studio 2010 or higher what you need is right here:

http://stackoverflow.com/questions/305447/using-different-web-config-in-development-and-production-environment
0
 
LVL 9

Accepted Solution

by:
rawinnlnx9 earned 1500 total points
ID: 39833349
I would also recommend using TeamCity as a deployment strategy. Once configured it will handle all the details as it promotes from DEV to TEST and on to {YOURPICK}.

http://www.jetbrains.com/teamcity/

TeamCity is free unless you have tons of projets and buildagents going on.
0
 

Author Comment

by:jeffreyjseaman
ID: 39833561
Thanks for the suggestion but this will not work for what we are trying to achieve.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question