I have the following connection string declared in my app.config file:
For a non-web project, and with app.config set up as in the OP here's what I usually do, since the config file changes names when the app is compiled (to yourapp.exe.config):
public static Configuration ExeConfig()
{
Assembly service = Assembly.GetAssembly(typeof(YourClass));
return ConfigurationManager.OpenExeConfiguration(service.Location);
}
Then to reference the s'th connection string:
ExeConfig().ConnectionStrings.ConnectionStrings[s].ConnectionString