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);

 

 

转载于:https://www.cnblogs.com/happykakeru/archive/2011/09/26/2191476.html

你可能感兴趣的:(ConnectionStringBuilder对象存储连接字符串)