jeffreyjseaman
asked on
ASP.Net Connection String
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the suggestion but this will not work for what we are trying to achieve.
http://stackoverflow.com/questions/305447/using-different-web-config-in-development-and-production-environment