由于你没有给DataAdapter 传给Connection 和Command
没有这两个就会出现上述的错误提示
你也看看msdn中的介绍,那里说的很清楚

解决方案 »

  1.   

    你在第一次
    con = new SqlConnection(conStr);
          con.Open();
          da = new SqlDataAdapter();
          da.SelectCommand.CommandText = "select top 10 8 from clientT";
          da.SelectCommand.Connection = con;
          da.SelectCommand.ExecuteReader();
          ds = new DataSet("myDataSet");
          da.Fill(ds,"table01");
    时,没有创建Command 对象,应该在
    con = new SqlConnection(conStr);
    SqlCommand cmd = new Sqlcommand();//创建对象
          con.Open();
          da = new SqlDataAdapter();
          da.SelectCommand =cmd;//加上Command 对象
          da.SelectCommand.CommandText = "select top 10 8 from clientT";
          da.SelectCommand.Connection = con;
          da.SelectCommand.ExecuteReader();
          ds = new DataSet("myDataSet");
          da.Fill(ds,"table01");
    你第二次
    da = new SqlDataAdapter("select .....",con);
    时,隐式创建了一个command 对象所以可行
      

  2.   

    da = new SqlDataAdapter(con);
      

  3.   

    to: zhangjie1234(后来者) 
    ------------------------
    thanks, 我已经明白;我要说的是, 要去掉da.SelectCommand.ExecuteReader();否则报告对象已经打开的ERROR;
    OK, THANKS AGAING;