For a long time I used:
ConfigurationManager.ConnectionStrings["sqlconnectionstring"].ConnectionString
to get the connection string from the app.config file
<configuration>
<connectionStrings>
<add name="sqlconnectionstring" connectionString="Data Source=ggg;Initial Catalog =DB;User ID=sa;Password=sa" />
</connectionStrings>
</configuration>
Lately I found that I canget the string using
global::myProj.Properties.Settings.Default.sqlconnectionstring;
- What is the difference?
- Can I access a key under appSetting?
- How come I don't need to import System.Configuration?
Thanks Asaf