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[0].Cells[0].Value.ToString() + "";

means ,The ID you are taking dbgrid1.SelectedRows[0].Cells[0].Value.ToString() is wrong.

Take It in a Watch window and find out what value is coming there.

Need Your Help

Recursive function for the recognition of the palindrome char arrays

c++ arrays recursion char

I been assigned this exercise at college, but I don't know how to implement the recursion structure ( " ??? " in the code ). In the if-cycle I should match the first character in the array with th...

Using language models for term weighting

python machine-learning scikit-learn n-gram text-classification

I understand that scikit supports n-grams using a Vectorizer. But those are only strings. I would like to use a statistical language model (https://en.wikipedia.org/wiki/Language_model) like this o...