Datatable split by row

Source: Internet
Author: User

Different data in the same database table must be bound to different repeater, which can be accessed multiple times, but the efficiency will be very low.

I want to first put the entire database table into the able (the table is not very large, otherwise the memory pressure will be great), and then perform operations in the memory.

Datatable dt = sourcedt. Clone (); // create a DT, source datatable structure based on the source datatable
Foreach (datarow DR in sourcedt. Rows)
{
If (condition to be split)
{
Datarow newdr = DT. newrow ();
Newdr. itemarray = dr. itemarray;
// Datarow is a reference type and cannot be directly assigned to DT. You can only copy the values in the row one by one.
DT. Rows. Add (newdr );
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.