I would like to connect to an existing database, and I put the connection string in the ConnectionStrings section of the Web.Config. But where and how do you refer to this connection in the code. For example, I try things like
string connString = System.Configuration.ConfigurationManager.ConnectionStrings["MyDatabase"].ToString();
in my C# code right before I read the database.
The only way I can make it work is to hard-code the connection string in the C# code, because I don't know how to get it from Web.Config.