C# Delete selected row from datagrid and database<>
This question already has an answer here:
In your code
The above code removes data from grid, and is working fine
But the below code not working properly (i e SQL query to delete row)
delcmd.CommandText = "DELETE FROM Users WHERE ID=" + dbgrid1.SelectedRows.Cells.Value.ToString() + "";
means ,The ID you are taking dbgrid1.SelectedRows.Cells.Value.ToString() is wrong.
Take It in a Watch window and find out what value is coming there.