DataTable的Distinct
DataTable dataTable;
DataView dataView = dataTable.DefaultView;
DataTable dataTableDistinct = dataView.ToTable(true,"FieldName1","FieldName2","...");//注:其中ToTable()的第一个参数为是否DISTINCT
DataTable 表的复制
DataTable dt = ""; //这里是填充DataTable数据
DataTable dtNew = dt.Copy(); //复制dt表数据结构
dtNew.Clear() //清楚数据
for (int i = 0; i < dt.Rows.Count; i++)
{
if (条件语句)
{
dtNew.Rows.Add(dt.Rows[i].ItemArray); //添加数据行
}
}