Hello,
This is regarding a windows app in Visual Studio 2005, a VB Windows application.
've stored a connection string called strSQLConn in My.Settings. I'm trying to change the Server in code. I set a string variable called strConn to a new Connection string.
My.Settings.Profile2006sql = strConn
This produces an error saying that My.Settings is readonly. I'm missing something basic here.
I don't know if this is the best way to change a connection string to toggle between a development server and a production server. My understanding is that if the setting Connection string is changed it will be used as the default for all the table adapters in a strongly typed dataset. Is that the case
Any suggestions for Settings Connection strings would be much appreciated.
Thanks Much

My.Settings is readonly/ changing Connection string
mdorison
User-scope settings can be changed and saved at run time, but application-scope settings are read-only and cannot be changed programmatically. Changing user-scope settings in VB is quite trivial ==>
My.Settings.Nickname = newNickname
Refer to this article for more details ==> http://msdn2.microsoft.com/en-us/library/shytyc55.aspx
CMOYA
Thanks, I'm still trying to figure out the "best practices" method of toggling saved connection strings so that the selected string will be used in all table adapters.
Euge GIm
Hi,
the simplest way to change settings of a windows application is changing the ApplicationName.exe.config file located in the same folder of application.
After you install the app, in the application path, you fnd the config file (xml file)... change the value of connection string and the setting is changed.
Hope this will help
mothballd
Thanks - I was thinking about using the tools in VS 2005. What I'm wondering is whether or not it's best to create two connection strings and then programatically toggle between them so that the selected connection string will be used in all table adapters.
I'm asking I think a really basic question: What is the "best practices" way of switching connection strings at run time
Thanks again for your time.