//去掉重复行
DataView dv = table.DefaultView;
table = dv.ToTable(true, new string[] { "name", "code" });
此时table 就只有name、code无重复的两行了,如果还需要id值则
table = dv.ToTable(true, new string[] { “id”,"name", "code" });
//排序
dt.DefaultView.Sort = "ID ,Name ASC";
dt=dt.DefaultView.ToTable();
dt=dt.DefaultView.ToTable();