Hi guys.
I have a dataset that binded into a wingrid. And I need to update the database in batch.
I thought of compare the dataset data with the wingrid data, but I failed to loop all the rows in the wingrid.
Another that I thought of is put a flag to indicate whether the row is updated or not. But same, I failed to loop all the rows.
Is there any option that I can use to get all the rows that get updated?
Thanks.
Updating your database is not going to have anything to do with the WinGrid. The WinGrid is just a front end for the user. All the changes made in the WinGrid and being pushed back into your dataset. If you want to get all the changes made in your dataset you could use the GetChanges method on the dataset object to get a new dataset with only updating being made plus some other records if necessary in order to maintain referencial integrity. Or you can check the RowState property of your data rows to see if they have been modified. But that would be the hard way of doing it. You should be using a table adapter.
As far as updating the data in batch that all depends on the capabilities of the backend database you are using. But it sounds like you should try normal updating first before you get into batch updating.
Hi Steve. I just got home from work. I'll try your suggestion on my own laptop.
Thanks a lot for your help, really appreciate it . :D
Specifically lookup ADO.NET TableAdapter and TableAdapterManager objects for making your database updates.
Hi, Steve.
Thanks for your suggestion, I got it done by checking the flag that I inserted in the dataset. The WinGrid automatically pushed back data into the dataset as you said.
I really appreciate your help, thank you very much.