I'm creating an app and I have a part where I have data in a table (datagridview). In this table I also have a button on each row.
My goal is to click on a button to delete the row where the button was clicked from the table and from the database where the application will fetch the information.
My code is the following:
public void update_tabelas()
{
    string queryprodutos = "SELECT * FROM produtos;";
    DataTable dtprodutos = new DataTable();
    MySqlCommand cmdprod = new MySqlCommand(queryprodutos, mConn);
    MySqlDataAdapter daprod = new MySqlDataAdapter(cmdprod);
    mConn.Open();
    daprod.Fill(dtprodutos);
    mConn.Close();
    this.tabelaprodutos.DataSource = dtprodutos;
    DataGridViewColumn col = new DataGridViewButtonColumn();
    col.Name = "Delete";
    col.DataPropertyName = "Delete";
    col.ReadOnly = true;
    this.tabelaprodutos.Columns.Add(col);
}
This code will fill the table and add the delete button on each row.
Now I don't know how to delete these data from the table and from the database.
I appreciate any suggestions and help.
 
    