I know there are a lot of questions and solutions related to it. But I am not getting them. I have a data table of records 8000
and it will increase in the futu
I hope this is what you want to achieve:
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading;
...
public void Test()
{
DataTable bigDataTable = GetBigDataTable();
var splitedTables = new List<DataTable>();
var smallTable = new DataTable();
int page = 1;
int pageSize = 1000;
List<DataRow> results;
while (true)
{
results = bigDataTable.AsEnumerable().Skip(pageSize * page++).Take(pageSize).ToList();
if (!results.Any())
break;
smallTable = results.CopyToDataTable();
splitedTables.Add(smallTable);
Thread.Sleep(1000 * 60 * 1);
} while (results.Any());
}
For this to work you need to add reference to System.Data.DataSetExtensions.
This is also similar question in SO.