求怎样连SQL Server数据库~急!!
string conStr = "server=.;database=" + txtSQL.Text.Trim() + ";uid=DBDEV;pwd=";
SqlConnection conn = new SqlConnection(conStr);
是这样写,但是连不上,uid指的是哪个?
------解决方案--------------------首先你要设置SA账户,设置密码
然后修改链接字符串,uid=sa;pwd=你设置的密码
------解决方案--------------------集成验证不需要uid pwd,需要Integrated Security=True;
------解决方案--------------------try
string conStr = "server=.;database=" + txtSQL.Text.Trim() + ";Integrated Security=True;";
------解决方案--------------------
string conStr = "server=MYASUS\DBDEV;database=" + txtSQL.Text.Trim() + ";Integrated Security=True;";
这样试试