声明了连接么
SqlConnection cnn = new SqlConnection(ConnectionString);
cnn.Open();声明了DataSet么
DataSet dsNode = new DataSet();

解决方案 »

  1.   

    连接有问题吧,你用IDE直接产生的代码试试
      

  2.   

    string ConnectionString="workstation id=IKNOW;packet size=4096;user id=sa;initial catalog=Northwind;persist security info=False";
          string strSql ="SELECT OrderID, CustomerID FROM Orders"
           SqlConnection  con = new SqlConnection(ConnectionString);
           con.Open();  
           DataSet dsNode = new DataSet();
           SqlDataAdapter adTemp;
           adTemp = new SqlDataAdapter(strSql, con);
           adTemp.Fill(dsNode,"dsNode");
      

  3.   

    同上
    添加了
    连接con声明
    DataSet dsNode声明
    应该没问题了
      

  4.   

    string ConnectionString="workstation id=IKNOW;packet size=4096;user id=sa;initial catalog=Northwind;persist security info=False";
    string strSql ="SELECT IsNull(Cast(OrderID as Varchar(50)),'') as OrderID , IsNull(Cast(CustomerID as Varchar(10)),'') as CustomerID FROM Orders"
    SqlConnection  con = new SqlConnection(ConnectionString);
    con.Open();  
    DataSet dsNode = new DataSet();
    SqlDataAdapter adTemp = new SqlDataAdapter(strSql, con);
    adTemp.Fill(dsNode,"dsNode");请比较一下。
      

  5.   

    现在在
    string ConnectionString="workstation id=IKNOW;packet size=4096;user id=sa;initial catalog=Northwind;persist security info=False";
          string strSql ="SELECT OrderID, CustomerID FROM Orders"
           SqlConnection  con = new SqlConnection(ConnectionString);
           con.Open();  
           DataSet dsNode = new DataSet(); /*报错说:未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。其他信息: 系统错误。*/
           SqlDataAdapter adTemp;
           adTemp = new SqlDataAdapter(strSql, con);
           adTemp.Fill(dsNode,"dsNode");
      

  6.   

    示例代码:
    SqlConnection nwindConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind");SqlCommand selectCMD = new SqlCommand("SELECT CustomerID, CompanyName FROM Customers", nwindConn);
    selectCMD.CommandTimeout = 30;SqlDataAdapter custDA = new SqlDataAdapter();
    custDA.SelectCommand = selectCMD;nwindConn.Open();DataSet custDS = new DataSet();
    custDA.Fill(custDS, "Customers");nwindConn.Close();