日期:2014-05-17 浏览次数:20458 次
System.Data.DataTable datatable = new System.Data.DataTable(); System.Data.DataTable newDataTable = datatable.Clone();//新的datatable int len = 10;//取出的数据条数 for (int i = 0; i < len; i++) { System.Data.DataRow row = newDataTable.NewRow(); row.ItemArray = datatable.Rows[i].ItemArray; newDataTable.Rows.Add(row); }
------解决方案--------------------
datatable dt1 = new datatable()
datatable dt2 = new datatable()
foreach(datarow drin in dt.table.rows)
{
dt1.rows.add(drinn)//具体要几条你自己选择
}
------解决方案--------------------
DataTable dt=new DataTable(); DataTable TakeTop10=dt.AsEnumerable().Take(10).CopyToDataTable<DataRow>();