using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
class Program
{
static void Main(string[] args)
{
foreach (ConnectionStringSettings css in ConfigurationManager.ConnectionStrings)
{
Console.WriteLine(css.Name);
Console.WriteLine(css.ProviderName);
Console.WriteLine(css.ConnectionString);
}
string sqlConnectString =ConfigurationManager.ConnectionStrings["AdventureWorks"].ConnectionString;
SqlConnection connection = new SqlConnection(sqlConnectString);
connection.Open( );
Console.WriteLine("Connection string state = {0}", connection.State);
connection.Close( );
Console.WriteLine("Connection string state = {0}", connection.State);
}
}