dataset changes RRS feed

  • Question

  • Hi,
    Assuming you are using an n-tier architecture for a windows application.
    Let say you populate a dataGridView (in winform .net 2.0 control) from a dataSet. Then you make several changes (i.e. delete, update, insert, ...) to this dataSet in the control.
    How can you then update the database with these changes. Should you use dataAdapter.Update(dataSet) in the datalayer or should you pass the dataset changes to the dataLayer and loop through each record in the dataset in a transaction and commit according to the changes i.e. .modified, added, deleted...


    Saturday, December 16, 2006 6:40 PM


  • you would do the dataAdapter.Update(dataset) method. Be sure you implemented the InsertCommand, UpdateCommand and DeleteCommand of the DataAdapter. If the functionality and tools are there, use it and dont create your own method as it would be inefficient than the ones developed especially for the .NET Framework - if its there, do it the .NET way :-)
    Saturday, December 16, 2006 6:51 PM