我在SQL SERVER 2000中把sa这个用户的密码设为空,然后在IIS里浏览ASP.NET网页时出现如下错误:
Server Error in '/eshop' Application.
--------------------------------------------------------------------------------用户 'sa' 登录失败。原因: 未与信任 SQL Server 连接相关联。 
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: 用户 'sa' 登录失败。原因: 未与信任 SQL Server 连接相关联。Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
[SqlException: 用户 'sa' 登录失败。原因: 未与信任 SQL Server 连接相关联。]
   System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
   System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
   System.Data.SqlClient.SqlConnection.Open() +384
   eshop.DAL.SQLHelper.PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, CommandType cmdType, String cmdText, SqlParameter[] cmdParms) in D:\My Projects\asp.net Projects\eshop\DAL\SqlHelper.cs:342
   eshop.DAL.SQLHelper.ExecuteReader(String connString, CommandType cmdType, String cmdText, SqlParameter[] cmdParms) in D:\My Projects\asp.net Projects\eshop\DAL\SqlHelper.cs:149
   eshop.DAL.SQLHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText) in D:\My Projects\asp.net Projects\eshop\DAL\SqlHelper.cs:118
   eshop.BLL.Product.GetCategoryList() in D:\My Projects\asp.net Projects\eshop\BLL\Product.cs:33
   eshop.CategoryList.Page_Load(Object sender, EventArgs e) in D:\My Projects\asp.net Projects\eshop\UserControl\CategoryList.ascx.cs:27
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Control.LoadRecursive() +98
   System.Web.UI.Page.ProcessRequestMain() +731 
求助!

解决方案 »

  1.   

    1楼请看:
    <add key="ConnectionString" value="server=HOME-64FAC760C1;database=eshop;uid=sa;pwd=" />
      

  2.   

    把属性中安全性的身份验证改成sqlserver&windows验证
      

  3.   

    先用SA 帐户在查询分析器里面登陆一下 如果不能用SA PSW=“”登陆的话
    应该是身份验证方式的事,  去SQL的企业管理器里面
    找到安全性 ,身份验证 ,里面选择sqlserver和windows验证 这一项
    如果还不行 别用密码为空 更改新密码
    最坏情况就是重新装一边SQL  注意把数据文件备份一下就OK了
      

  4.   

    <add key="ConnectionString" value="server=(local);database=eshop;uid=sa;pwd=;" />
    SQL使用混和模式登陆
      

  5.   

    format_leon() 正解,非常感谢。
    同时对楼上所有热心帮助我的朋友表示感谢。