你的SQL Server 对IUSR_XCH 用户没有Select权限。
解决方法
1.在SQL Server 中添加用户“IUSR_XCH ”并给出相应权限。
2.修改你的连接窜,改为“server=localhost; database=yourDataBase; Uid=sa;pwd="” 不要用server=localhost; database=yourDataBase;Trusted_Connection=yes"

解决方案 »

  1.   

    Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. 
    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: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.Source Error: 
    Line 30:  {
    Line 31:  // Put user code to initialize the page here
    Line 32:  sqlDataAdapter1.Fill(ds1);
    Line 33:  DataGrid1.DataBind();
    Line 34:  }
     Source File: c:\inetpub\wwwroot\webapp5.17\webform1.aspx.cs    Line: 32  YellowWee(端木柒),谢谢你,但是为什么用了你的两种方法都没有成功,而且我用了sa登陆数据库都不行
      

  2.   

    你的SQL要是混合验证模式,sa才能登陆上!!