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?
Algo RhythmPosted Dec 16, 2009, 12:52 PM
Kumar AGPosted Dec 16, 2009, 11:49 AM
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 RhythmPosted Dec 16, 2009, 10:45 AM
Algo RhythmPosted Dec 16, 2009, 10:45 AM