问题出现在SqlConnection myConnection = new SqlConnection("server=(local)\\NetSDK;database=pubs;Integrated Security=SSPI");这里
你把local换成localhost,如果不成功,那么你看看你任务栏的服务器用的名称是什么,server=“你的服务器名称”

解决方案 »

  1.   

    SqlConnection myConnection = new SqlConnection("server=DARLING\\WS;database=pubs;Integrated Security=SSPI");
    改了之后又这样了异常详细信息: System.Data.SqlClient.SqlException: 用户 'DARLING\ASPNET' 登录失败。
      

  2.   

    SqlConnection myConnection = new SqlConnection("server=(local)\\NetSDK;database=pubs;Integrated Security=SSPI");
            如果还不行,那你改这个吧SqlConnection myConnection=new SqlConnection("server=localhost;uid=sa;pwd=;database=pubs");//PWD是密码,如果没有就不要写(你数据库密码,UID是你装数据库的指定用户名。
      

  3.   

    SqlConnection myConnection=new SqlConnection("sever=
    (local);user id=sa;pwd=[];database=pubs")  user id 为你安装Sql时输入的用户名,[]中的为sql的密码