Filter and retrieve a row record from DataTable

Source: Internet
Author: User

Question "How can I obtain a record if I have a DataTable?"

DataTable:

DataTable Dtable = Dtable. columns. add (, (Dtable. columns. add (, (Dtable. columns. add (, (Dtable. rows. add (, Dtable. rows. add (, Dtable. rows. add (,,}


The following methods are used for demonstration.
The first is to use the RowFilter () method of DataView:



Bind to Data Control:

. GridView1.DataSource =. GridView1.DataBind ();


Method 2:


Method 3:


The fourth method is actually a simplified version of the third method:


The second, third, and fourth methods are bound to the Data Control:

. GridView1.DataSource =. GridView1.DataBind ();


The fifth method uses the Select method of DataTable to query multiple fields.


Bind to Data Control:

. GridView1.DataSource =. GridView1.DataBind ();


Method 6:
Http://www.cnblogs.com/insus/archive/2012/08/22/2650137.html

Related Article

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.