ConnectionStringBuilder对象存储连接字符串
SqlConnection conn = new SqlConnection();
SqlConnectionStringBuilder connstrbd = new SqlConnectionStringBuilder();
connstrbd.DataSource = @".\SQLEXPRESS";
connstrbd.IntegratedSecurity = true;
connstrbd.InitialCatalog = "MyDB";
conn.ConnectionString = connstrbd.ConnectionString;
SqlConnection conn = new SqlConnection();
string connstr="Data Source=.\SQLEXPRESS;Intergrated Security=True;Database=MyDB;";
SqlConnectionStringBuilder connstrbd = new SqlConnectionStringBuilder(connstr);