DataRow[] rows = dt.Select(
""
,
"name asc"
);
DataTable t = dt.Clone();
t.Clear();
foreach
(DataRow row
in
rows)
t.ImportRow(row);
DataTable1 = t;
方法2:
DataView dv = dt.DefaultView;
dv.Sort =
"name Asc"
;
DataTable dt2 = dv.ToTable();
方法3:
/拿到数据源
DataView dv = dt
.Copy().DefaultView;
//排序
dv.Sort =
"name asc,age desc"
;
DataTable tempdt = dv.Table;