DataTable去重复方法

//去掉重复行

DataTable table=new DataTable();

 

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" });//第一个参数true 启用去重复,类似distinct

详情查看:http://www.cnblogs.com/wifi/archive/2013/02/19/2916565.html

posted on 2015-01-14 18:17  taian_xiaojia  阅读(275)  评论(0)    收藏  举报

导航