关于vs2005c#连接sql2000
代码:
             string connect = "server=(local)\\HL;database=test;user id =test;password=123456";
             SqlConnection conn = new SqlConnection(connect);
             string select = "select * from location where id=1";
             conn.Open();
             SqlCommand comm = new SqlCommand(select,conn);
             int rowsreturned = comm.ExecuteNonQuery();
             MessageBox.Show(rowsreturned+" row was affected");
             conn.Close();
            在conn.open处出错
                         (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)
            把(local)\\HL改成(local)后程序能运行,但是最后结果显示-1 row was affected
            求高人解救  
------解决方案--------------------(local)\HL是本地安装的命名实例,(local)是本地安装的缺省实例。
你的机器上装了几个实例?如果只安装了一个缺省实例,(local)应该是正确的。
------解决方案--------------------正常.
ExecuteNonQuery()方法对insert,update,delete操作返回影响行数,对其它操作返回-1