我使用 ds.Table[0].TableName="aa" ,测试说对象"aa"无效,不使用SqlDataAdapter,应该怎么办

解决方案 »

  1.   

    SqlConnection con = DB.getconn();
            dr = new SqlDataAdapter("select * from pinglun where tid=" + id + " order by id desc", con);
            ds = new DataSet();
            dr.Fill(ds, "employee");
      

  2.   

    大哥,不用SqlDataAdapter怎么做
      

  3.   

    在定义table的时候就得赋值名称的,如
    DataTable table = new DataTable("One");
    DataSet set = new DataSet("set");
    set.Tables.Add(table);
      

  4.   

    ds.Tables[0].TableName = "aa";
      

  5.   

    我使用DataSet存储过程绑定了GridView,然后用存储过程做分页,需要表名,在绑定GridView后怎么设置
      

  6.   

    为什么一定需要表名?GridView不是只要有DataSource就行了?不能用index指定么?
      

  7.   

    DataSet ds = new DataSet();
    DataTable dt = new DataTable("");
    ds.Tables.Add(dt);
    通过分页存储过程获取数据,直接绑定到gridview,分页时再查询绑定
      

  8.   

    ds.Tables[0].TableName = "aa";