i tried to delete data from datagridview . it is not deleting row in mysql but removes in datagridview.
My code is
private void update_Click(object sender, EventArgs e)
{
DataTable dt = ds.Tables["distributor"];
this.dataGridView1.BindingContext[dt].EndCurrentEdit();
this.da.Update(dt);
}
private void delete_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == dataGridView1.Rows.Count)
{
dataGridView1.Rows.Clear();
}
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
dataGridView1.Rows.Remove(row);
}
}
pls help me.
thank you
Deleting row in mysql from datagridview
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Roei BarRank #1,271 · 1.4K reputationPosted Sep 10, 2009, 12:38 AM EDT
before the remove command, execute a delete statment by the selected Row indicator that is the key in the table you want to delete