I have a Parent Datatable that contains 4.5 records, I want to now create Dictionary of datatables from Parent Datatable until all records are process each table should have no more than the max number of records. At the end I want iterate through the dictionary of tables and export to a textfile. I am doing this becuase I am getting a system out of memory exception writing 4.5 million records to an textfile, so I now have to break up into pieces until all records are process.
any ideals?
Loading
David SmithPosted May 8, 2012, 11:45 AM
private List<DataTable> CloneTable(DataTable tableToClone, int countLimit){
List<DataTable> tables = new List<DataTable>();
int count = 0;
DataTable copyTable = null;
foreach (DataRow dr in tableToClone.Rows)
{
if (count == 750000){
copyTable = new
copyTable = tableToClone.Clone();
DataTable();// Clone the structure of the table. // Add the new DataTable to the list.tables.Add(copyTable);
}
// Import the current row.copyTable.ImportRow(dr);
}
}
return tables;}