Datagrid; update database

Feb 13, 2009 at 10:40 AM
Hello,

I have a problem with the datagrid and updating the database.

When the data in the grid is bound with an in-memory table, and I want to update the database, I can check for the RowState. 
So I only update the database with records that really did change.

Now the data in the grid I use, comes from a List: public class VingList : List<Ving>
Everything works fine (validation and so on), but I do not know how to update the database.
How do I know wich record is changed? Do I have to compare every record in the list to look for changes??
I don't want to update all the records in the list when only a few records are changed.
I could'n find anything like 'RowState' or so.

Thanks in advance,
Coordinator
Feb 13, 2009 at 12:06 PM
Take a look at Colin Eberhardt's article, http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx.  That should probably help you out.
Feb 13, 2009 at 1:09 PM
Hi Vinsibal,
Thanks for your reply. I did read the article (and many others) but it didn't help.
What I want is for the user to 'play'around in the grid (add/delete and insert).
I do validate the cells during these updates, but to commit the changes to the database the user explictly needs to click on a 'save' button.
At that point I only want the 'changed' records to commit to the database. But how can I detect wich records are changed when I don't have a RowState or RecordState?