Comparison of data between DataGrid and database

0

Hello everyone, I have a question in my application, because it runs a pocket pc connected to mysql by inserting it into the product table (productID, cod_barr, description), and on the other side there is an application with a datagridview showing what this is being inserted into the table by that pocket pc, before displaying on the grid I would like to check if I am not picking up an existing record or bringing only those records that are not already listed on the grid

    
asked by anonymous 08.09.2015 / 21:43

1 answer

0

I do not think you need to do this check, I think it's a lot simpler to undo and update the dataSource of your dataGridView, as follows:

dataGridView.DataSource = null;
dataGridView.Update();
dataGridView.Refresh();

and then simply repopulate the DataSource:

List<Produtos> objListProdutos = new List<Produtos>();
dataGridView.DataSource = objListProdutos;
    
08.09.2015 / 22:23