I want to get a connection string from the app.config
file.
connectionString = System.Configuration.ConfigurationSettings.AppSettings["DBEntities"];
But it doesn't work. It's empty.
I cannot access the System.Configuration.ConfigurationManager
because it's .NET 4.
How can I get my connection string from the app.config
?
Use
string connectionString = ConfigurationManager.ConnectionStrings[connectionName].ConnectionString;
Make sure to add reference to System.configuration
in your project.