用户 '(null)' 登录失败。原因: 未与信任 SQL Server 连接相关联。

来源:百度知道 编辑:UC知道 时间:2024/05/26 11:29:45
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 用户 '(null)' 登录失败。原因: 未与信任 SQL Server 连接相关联。

Source Error:

Line 25: SqlConnection con=new SqlConnection("server=.;database=login:uid=sa;pwd=;");
Line 26:
Line 27: con.Open();
Line 28:
Line 29: SqlCommand cmd=new SqlCommand("select count(*) from login where userName='"+userName+"' and userPwd='"+userPwd+"'", con);

Source File: c:\inetpub\wwwroot\shiyan2-1\login.aspx.cs Line: 27

Stack Trace:

[SqlException: 用户 '(null)' 登录失败。原因: 未与信任 SQL Server 连接相关联。]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Dat

("server=.;database=login:uid=sa;pwd=;");

这个地方仔细对照下sql数据库,地址,库名,以及该库授权的用户和密码。

SOL设置问题,或者权限没设置好