DataRow newdr = newdt.NewRow();
newdr.ItemArray = dt.Rows[Index[i]].ItemArray;
newdt.Rows.Add(newdr);

解决方案 »

  1.   

    http://lucky_elove.www1.dotnetplayground.com/ShowDetail.aspx?id=12912741-070C-41DE-8D08-50C8DDA1F864
      

  2.   

    改过来以后提示错误,Input array is longer than the number of columns in this table.为什么?
    dt对象是这样生成的,DataTable dt = myDataSet.Tables["dg_cur_bytime"];有四个colums,
      

  3.   

    来晚了
    同意dongchuanlu(匡奇)
      

  4.   

    DataRow newdr = newdt.NewRow();
    newdr.ItemArray = dt.Rows[Index[i]].ItemArray;
    newdt.Rows.Add(newdr);
      

  5.   

    这个方法也报错阿,Input array is longer than the number of columns in this table。谁能提供可用得代码?或讲解一下这个概念?
      

  6.   

    是不是可以用dataview来实现呢?
      

  7.   

    使用权DataTable对象的Select方法筛选记录,或者建立Dataview.如:
    DataRow[] currRows = workTable.Select(条件表达式, 排序表达式, DataViewRowState.CurrentRows);如果您将对 DataTable 的 Select 方法执行多次调用,可通过先为 DataTable 创建 DataView 来提高性能。