Quick Search from a dataset: DT. Select ("")

Source: Internet
Author: User

The dataset queried from the database according to the specified conditions is put into the able. This is a common usage and does not need to be detailed. With the dataset, we need to perform another matching, find the qualified data item, and output the data in the row or store it in another able. How do I do this? I used to use loops, either for (INT I = 0; I <DT. Rows. Count; I ++) or foreach (datarow DR in DT. Rows ). Later, it was found that this was too slow. Sometimes it was just a piece of data, and every time it had to loop through the entire dataset, wasting server resources and user time. So I switched to a datatable object method: Public datarow [] Select (string filterexpression), which avoids the server overhead caused by loops and saves time. For a large amount of data, it is a good solution. If you are interested, you can try it in future development ~~

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.