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