Advice on using DataTables/DataViews/Grids
Posted on 2012-09-14
I'm hoping somebody can give me advice on the following scenario using ADO.Net.
I have a Windows Fom which contains two combo boxes and a DataGrid.
When I select certain values in the combo boxes, the DataGrid is populated with some of the data from an SQL table; lets call it TableA for now.
The user is allowed to Add/Edit/Delete entries in the populated DataGrid.
Suppose the user makes Add/Edit/Delete(s) and then re-selects the combos so the data now displayed in the DataGrid may change. Further changes could then be made and the process could be repeated several times.
I'm adding a button which will be called "Update" which when pressed would carry any changes over to the underlying database.
My question is, what is the best way to accomplish this?
Do I really need to download TableA entirely into a DataTable first? Wouldn't it make sense simply to download the rows which match the criteria of the two combo boxes? However, if I do this, won't the logic become complex?
Any advice would be most appreciated.