Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Split Datatable into multiple Datatables

    • 0
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.65k
    Comment on it

    Split Datatable into multiple Datatables

    private List<DataTable> CloneCustomerDataTable(DataTable dtClone, int numberOfRecords)
        {
            List<DataTable> dttables = new List<DataTable>();
            int count = 0;
            DataTable dt = null;
            foreach (DataRow dr in dtClone.Rows)
            {
                if ((count++ % numberOfRecords) == 0)
                {
                    dt = new DataTable();
                    dt = dtClone.Clone();
                    dt.TableName = "dtCustomer" + count / numberOfRecords;
                    dttables.Add(dt);
                 }
                dt.ImportRow(dr);
            }
            return dttables;
        }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: