DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Rows.Add(new object[] { 12, "lwolf" }); dt.Rows.Add(new object[] { 100,"kkkkk"}); dt.Rows.Add(new object[] { 19,"jim" }); dt.Rows.Add(new object[] { 1,"test" }); DataTable dtCopy = dt.Copy(); DataView dv = dt.DefaultView; dv.Sort = "ID"; dtCopy = dv.ToTable();
可以根据多行排序