i tried many things . but still am not able to find the solution how to delete the selected row from the datagridview in a window application and saving the changes to the database.
still waiting for the reply..........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Jul 23, 2010, 12:00 AM
Another possibility is my article Database Table Update in a DataGridView without Writing Code.
Mamta MPosted Jul 22, 2010, 6:17 AM
private void datagvw_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
{
int i = e.Row.Index;
tableadapter.Adapter.DeleteCommand = new SqlCommand("Delete from Products where ProductCode=" + ds.Books.Rows[i][0], tableadapter.Connection);
tableadapter.Adapter.DeleteCommand.ExecuteNonQuery();
}
Posted Jul 22, 2010, 5:18 AM
please tell me the whole code.
Mamta MPosted Jul 22, 2010, 2:43 AM
-Mamta