C# 链接 sql server 数据库字符串

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

上一篇:c#连接oracle 数据库


下一篇:C# SqlDataReader