SqlConnectionStringBuilder sqlb = new SqlConnectionStringBuilder();
sqlb.DataSource = "ip address";
sqlb.InitialCatalog = "databasename";
sqlb.UserID = "username";
sqlb.Password = "password";
sqlb.IntegratedSecurity = false;
sqlb.Pooling = true;

SqlConnection conn = new SqlConnection();
conn.ConnectionString = sqlb.ConnectionString;
conn.Open();

  conn.Close();

posted on 2019-12-29 14:45  Lionever  阅读(400)  评论(0编辑  收藏  举报