I try to connect to my database and I can do that using following code:
using (SqlConnection conn =
new SqlConnection("Data Source=.\\SQLEXPRESS; Initial Catalog=DocumentManager; Persist Security Info=True; Integrated Security=True"))
{ ... }
But, when I try this:
string connectionString = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connectionString)) { ... }
it doesn't work anymore. My Connection String looks like this:
<add name="DatabaseConnection" connectionString="Data Source=.\\SQLEXPRESS; Initial Catalog=DocumentManager; Persist Security Info=True; Integrated Security=True" />
And, I can read the connectionString variable and it looks exactly like the string in the first case.
it doesn't work anymore.?