How can I get ConnectionString Name from config file
According to the documentation it should work like this:
ConnectionStringSettingsCollection connections = ConfigurationManager.ConnectionStrings;
if (connections.Count != 0)
{
foreach (ConnectionStringSettings connection in connections)
{
string name = connection.Name;
}
}
Use
ConfigurationManager.ConnectionStrings[0].Name