DataView的ToTable方法,类似数据库Distinct。

 

想要选出datatable中同一个字段的不同值,类似select distinct 字段 from tablename;

DataTable dt = new DataTable();
DataView dr = dt.DefaultView;
dr.ToTable(true,"字段1","字段2"..);// 第一个参数,表示是否distinct,后面的参数就是你要distinct的字段,可以有多个值。

posted @ 2015-09-01 17:15  梦游生  阅读(720)  评论(0编辑  收藏  举报