Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想对 的所有数据进行排序DataTable,我想Column2按字母顺序排序。
DataTable
Column2
DataView dv = new DataView(DT); dv.Sort = "Column2 ASC"; DT.DefaultView.Sort = "Column2 ASC";
DataView dv = yourDataTable.DefaultView; dv.Sort = "Column2"; yourDataTable = dv.ToTable();
您不需要添加 ASC,这是默认设置,除非您想要 DESC :) 此代码对我有用 :)