. NET DataTable Correct sort posture

Source: Internet
Author: User

About the correct posture of column sorting in a DataTable make an essay that is easy to read
1System.Data.DataTable dt =NewSystem.Data.DataTable ();2Dt. Columns.Add ("Date",typeof(System.String));3System.Data.DataRow dr =dt. NewRow ();4dr["Date"] ="2016-09";5System.Data.DataRow DR1 =dt. NewRow ();6dr1["Date"] ="2015-09";7System.Data.DataRow DR2 =dt. NewRow ();8dr2["Date"] ="2014-09";9System.Data.DataRow DR3 =dt. NewRow ();Tendr3["Date"] ="2016-06"; OneSystem.Data.DataRow DR4 =dt. NewRow (); Adr4["Date"] ="2013-10"; - dt. Rows.Add (DR); - dt. Rows.Add (DR1); the dt. Rows.Add (DR2); - dt. Rows.Add (DR3); - dt. Rows.Add (DR4); -System.Data.DataView DV =dt. DefaultView; +Dv. Sort ="Date"; -System.Data.DataTable DT1 =DV. ToTable (); +  A             foreach(System.Data.DataRow VardrinchDT1. Rows) at             { -Console.WriteLine (vardr["Date"]. ToString ()); -}

. NET DataTable Correct sort posture

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.