Home > Net >  Help ~ ~ ~ c # dataGridView control how to judge whether data repeat before adding data
Help ~ ~ ~ c # dataGridView control how to judge whether data repeat before adding data

Time:03-30

TextBox value added to the dataGridView line by line, add the former judge whether to have duplicate values,


CodePudding user response:

refer to the original poster qq_39314390 response:
add TextBox value line by line to the dataGridView, add before judge whether to have duplicate values,




There are many ways to write a string [] array, to go to, again write to dt,
Or write dt first, and then to go to clone,
 
The DataTable dt=db. GetDt (" select * from table name ");//get the datatable
The DataView dv=new DataView (dt);//table view
The DataTable dt2=dv. ToTable (true, "the name, age, hobby");//which fields to heavy, write down the field name, wrote three columns on the demo fields, removal of 3 columns have repeated the dt2 written,

CodePudding user response:

Turn the DataTable dataGridView? Just want to simple to add the value of the textBox dataGridView cell in a row, after input value added to the dataGridView textBox, add before judge whether there is repeated in the dataGridView, a repeat is not to add,
  •  Tags:  
  • C#
  • Related