split a datatable based on number of rows
DataTable[] splittedtables = tbl.AsEnumerable()
.Select((row, index) => new { row, index })
.GroupBy(x => x.index / 12) // integer division, the fractional part is truncated
.Select(g => g.Select(x => x.row).CopyToDataTable())
.ToArray();
3.89
9
List<DataTable> result = DTHead.AsEnumerable()
.GroupBy(row => row.Field<int>("MIVID"))
.Select(g => g.CopyToDataTable())
.ToList();
Thank you!
9
0
Are there any code examples left?
New code examples in category C#