,,数据库是在别人的机子上,,别人的机子IP 是 192.168.1.59
我机子是sql 2005 版本,但是用到的却是连接在别人机上的sql 2000 ,,
我用下面的语句连接数据库
string StrConnection = "server=192.168.1.59;database = infoERP;uid=sa;pwd= ;";
SqlConnection SqlConn = new SqlConnection(StrConnection); SqlCommand SqlComm = new SqlCommand("Select * from icvBrand WHERE (StatusDesc IS NOT NULL) AND (BrandName = 'a')", SqlConn);
SqlConn.Open(); SqlDataReader SqlDaR = SqlComm.ExecuteReader();运行是报错为:Login failed for user 'sa'. 为什么啊 ?????????
我机子是sql 2005 版本,但是用到的却是连接在别人机上的sql 2000 ,,
我用下面的语句连接数据库
string StrConnection = "server=192.168.1.59;database = infoERP;uid=sa;pwd= ;";
SqlConnection SqlConn = new SqlConnection(StrConnection); SqlCommand SqlComm = new SqlCommand("Select * from icvBrand WHERE (StatusDesc IS NOT NULL) AND (BrandName = 'a')", SqlConn);
SqlConn.Open(); SqlDataReader SqlDaR = SqlComm.ExecuteReader();运行是报错为:Login failed for user 'sa'. 为什么啊 ?????????
你登陆别人的机器时应该是用windows登陆
可能对方的数据库用的是windows集成安全,你试试用用这个连接字符串,应该是这个问题
密码为空格么?
如果没有密码,去掉空格