SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder.DataSource = ""; builder.InitialCatalog = ""; builder.IntegratedSecurity = true; string connectionString = builder.ConnectionString;这样也可以构造数据库连接字符串。