datatable removes duplicate lines
- 2020-06-12 10:30:24
- OfStack
Remove duplicate rows in DataTable (all columns have the same data) :
//DataView dv = dt3.DefaultView; //dt3 The default virtual view
//dv.Sort = "wmid asc"; // The sorting
///dv.ToTable(true, " The column name , The column name , The column name ");
/// The first 1 The parameters, true To get rid of repetition, false Do not remove
/// The first 2 The fields to be displayed
DataView dv = new DataView(dtname); //dtname Refers to the need to remove duplicate lines datatable The name
dtname = dv.ToTable(true);