C#连接数据库字符创

1.集成的windows验证

string constr = "server=.;database=myschool;integrated security=SSPI";

2.SqlServer身份验证

string constr = "data source=.;initial catalog=myschool;user id=sa;pwd=sa";

web.config配置

   

在C#中连接的语句

public static string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["mysql"].ToString();
 

你可能感兴趣的:(数据库)