Updating Database From DataGrid
I have a datagrid with a record bound to it from a database. The SELECT statement is of this form SELECT * FROM Table1 WHERE ID = @ID. I had VS generate the UPDATE and DELETE statements automatically. I do not understand why when I edit the datagrid for some records the data change is persisted in the database and for others it is not?
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Algo Rhythm40 reputationPosted Dec 16, 2009, 5:45 AM EST
Algo Rhythm40 reputationPosted Dec 16, 2009, 5:45 AM EST
Kumar AG48 reputationPosted Dec 16, 2009, 6:49 AM EST
http://msdn.microsoft.com/en-us/library/aa0416cz(VS.71).aspx
MSDN:
Note that it is recommended to always return a unique primary key value in your query. Otherwise, the preceding UPDATE statement may update more than one row, which might not be your intent.
Algo Rhythm40 reputationPosted Dec 16, 2009, 7:52 AM EST