Settings.settings options in C # for ConnectionString

I would like to know if there is a way to declare a variable in the setup.setting file to store my connection string. then I can read it from there, for example:
properties.settings.default.connectionstring

thanks

+4
source share
2 answers

Add settings on the Options tab in the properties of your project. Make sure this is a user area, not an application area, or that it will be read-only. Then go into it through Settings.Default.ConnectionString

Just keep in mind that this is not “safe” if that is your goal. Simply simplifies runtime changes compared to the configuration file. Please note that the settings are actually stored in the configuration file.

+1
source

Is there a problem using the recommended (web application) .config to store connection strings?

How to read connection strings from a .config file

0
source

All Articles