[.NET]將Datatable做order by

  • 1702
  • 0

[.NET]將Datatable做order by

如下:

DataTable dtCopy = dtOriginal.Copy();
var Rows = (from row in dtCopy.AsEnumerable()
			orderby row["DrawNo"] descending
			select row);
dtCopy = Rows.AsDataView().ToTable(); 


參考資料:
How to sort a data table in C# with LINQ