当前位置: 代码迷 >> ASP.NET >> 请教:Windows身份,连接数据库有关问题
  详细解决方案

请教:Windows身份,连接数据库有关问题

热度:4564   发布时间:2013-02-25 00:00:00.0
请问:Windows身份,连接数据库问题
string   connstr   =   String.Format(@ "data   source= 'hss\hss ';initial   catalog=master;Integrated   Security=SSPI; ",   server);

                SqlConnection   con   =   new   SqlConnection(connstr);
                con.Open();

这样一个Windows身份登录的代码
在连接sql2005时候通过
连接sql2000时候不通过

------解决方案--------------------------------------------------------
和尚来看你了
------解决方案--------------------------------------------------------
try:

string connstr = String.Format(@ "data source= 'hss\hss ';initial catalog=master;Trusted_Connection =true; ", server);


PS;如果是别人电脑上的SQL2000,要确定SQL2000安装了SP4,2000要安装了2000才支持远程链接,然后要确定远程支持Windows验证

------解决方案--------------------------------------------------------
虾米错误哦
------解决方案--------------------------------------------------------
sp_grantlogin 'xxxx\aspnet '

因为你做的是授权而不是添加,要分清grant和add的区别
  相关解决方案