I am trying to delete data from Datagridview and Database simultaneously but it is not deleting the data from database and showing no error.
foreach (DataGridViewRow item in this.category_grid.SelectedRows)
{
string name = item.Cells[0].Value.ToString();
connection.Open();
OleDbCommand command = new OleDbCommand("delete from Category where CatName = '" +name+ "'",connection);
command.ExecuteNonQuery();
category_grid.Rows.RemoveAt(item.Index);
connection.Close();
}