Several common Query expressions of datatable

Source: Internet
Author: User

Http://hi.baidu.com/jiang_yy_jiang/blog/item/27ab17c436e2a6c638db496f.html

 

Datatable dt = getdetails (). Tables [0]; // obtain available datatable

// Var M = DT. asenumerable (). Last <datarow> (); returns the last datarow row of the datatable.

// Var M = DT. asenumerable (). First <datarow> (); returns datarow of the first row of the able.

// Var M = DT. asenumerable (). Count <datarow> (); returns the total number of datatable rows.

// Var M = DT. asenumerable (). elementat <datarow> (tipindex); returns the datarow of the tipindex entry of the able.

// Var M = DT. asenumerable (). Reverse <datarow> (); sorts datatable in reverse order.

// Var M = DT. asenumerable (). Skip <datarow> (tipindex); tipindex entries before the datatable are skipped

VaR M = DT. asenumerable (). Take <datarow> (tipindex); // extract the tipindex entries before the datatable.

Datatable T = M. copytodatatable <datarow> ();

The last uncommented is frequently used and can be used to extract the first n rows, similar to Top N in SQL.

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.