Answers for "split a datatable based on number of rows"

C#
0

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();
Posted by: Guest on April-02-2021
0

split a datatable based on number of rows

List<DataTable> result = DTHead.AsEnumerable()
            .GroupBy(row => row.Field<int>("MIVID"))
            .Select(g => g.CopyToDataTable())
            .ToList();
Posted by: Guest on April-02-2021

Code answers related to "split a datatable based on number of rows"

C# Answers by Framework

Browse Popular Code Answers by Language