c# - Edit parameters in Settings file -


i have dataclasses.dbml file in c# winforms project. automatically adds setting of type connectionstring settings file of project. connection string throughout project accessed using setting.

now when work on pc, connects database , works fine. how set new connection string depending on client's host , instance names in settings file permanently , once (during setup).

i tried doing:

settings.default.connectionstring = "sqlconnectionstring"; settings.default.save(); 

but gives compile-time error read-only.

my aim set connectionstrings according clients setting. dont want make hard coded.

add partial class definition following

public partial class dataclasses {            partial void oncreated()     {         connection.connectionstring = sqlhelpers.getconnectionstr();     } } 

where sqlhelpers.getconnectionstr should lookup settings users app.config file.

remember put in separate file auto-generated dbml file.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -