DataTable 中Distinct操作

 

 

 

 DataTable dt = ds.Tables[0];
 DataView dataView = dt.DefaultView;
 DataTable dtDistinct = dataView.ToTable(true, "GC002_UserID", "GC002_UserName","字段3","字段3","字段5");//DataTable根据 UserID去掉重复的
//ToTable中最终填写的的字段 最终会在dtDistinct的列内包含,其他没有填写的字段将不在包含

 

posted @ 2015-06-01 14:19  高山-景行  阅读(435)  评论(0编辑  收藏  举报