I\'m writing a Winforms app in C# that enables the user to edit and update database using the datagridview.
The problem is, I can\'t make it to work. The only thing
You can have a save or update button to execute the code like this:
bindingSource1.EndEdit();
DataTable dt = (DataTable)bindingSource1.DataSource;
dataAdaper.Update(dt);
You will save all changes you made, but if you sort datagridview columns first then change data then run the save code above you will miss one record, the top first one before you sort. To fix it, you have to sort it back then save them. The best way to do it if you know which column to sort, you need to sort it when you load data to datagridview.
Jia Zhuang