我的sqlserver2000用的是windows NT 集成安全设置
如果用指定的用户名和密码验证就不行
con=new SqlConnection("workstation id=HSY;packet size=4096;integrated security=SSPI;data source=HSY;persist security info=False;initial catalog=newxy");
sql="select 用户id from usertable where username='{0}' and password='{1}'";
sql=String.Format(sql,txtlogin.Value,txtpwd.Value);
cmd=new SqlCommand(sql,con);
con.Open();出错;
我在设计web页面时加了一个sqlconnection然后新建了一个连接,成功可以连接到数据库
我把connectionstring拷贝下来粘贴到新建的sqlconnection con中在程序中运行con.open
提示错误:
用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败。源错误:
行 68: sql=String.Format(sql,txtlogin.Value,txtpwd.Value);
行 69: cmd=new SqlCommand(sql,con);
行 70: con.Open();
nt验证与用户名口令验证的connnectionstring 有什么不同吗?怎么写才对啊?
如果用指定的用户名和密码验证就不行
con=new SqlConnection("workstation id=HSY;packet size=4096;integrated security=SSPI;data source=HSY;persist security info=False;initial catalog=newxy");
sql="select 用户id from usertable where username='{0}' and password='{1}'";
sql=String.Format(sql,txtlogin.Value,txtpwd.Value);
cmd=new SqlCommand(sql,con);
con.Open();出错;
我在设计web页面时加了一个sqlconnection然后新建了一个连接,成功可以连接到数据库
我把connectionstring拷贝下来粘贴到新建的sqlconnection con中在程序中运行con.open
提示错误:
用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败。源错误:
行 68: sql=String.Format(sql,txtlogin.Value,txtpwd.Value);
行 69: cmd=new SqlCommand(sql,con);
行 70: con.Open();
nt验证与用户名口令验证的connnectionstring 有什么不同吗?怎么写才对啊?
晕的很啊
server=(local);database=数据库;uid=sa;pwd=密码