none
TableAdapter.Update(dataset.table) RRS feed

  • Question

  •  

    When I attempt to update a SQL table with multiple rows at one time, if one of the rows already exists in the SQL table, the update throws an exception and the whole update fails. Is there a way to have the update ignore duplictates, and to have the other (good records) update properly?

     

    I know I can query the table before hand to make sure the records don't already exist, but if I have to do that, I don't see the point in using datasets in the first place. The whole idea is to minimize the number of times the app connects to SQL.

     

    Thanks

     

     

    Friday, June 20, 2008 5:16 PM

Answers

  • You could set the adapter's ContinueUpdateOnError property.  If a row cannot be updated, the error message is placed in the row's RowError property.

     

    - or -

     

    You could handle the adapter's RowUpdated event.  The event arguments have an e.Errors that you can check for errors and an e.Status that you can set to specify whether processing should continue.

     

    Sunday, June 22, 2008 10:44 PM

All replies

  • You could set the adapter's ContinueUpdateOnError property.  If a row cannot be updated, the error message is placed in the row's RowError property.

     

    - or -

     

    You could handle the adapter's RowUpdated event.  The event arguments have an e.Errors that you can check for errors and an e.Status that you can set to specify whether processing should continue.

     

    Sunday, June 22, 2008 10:44 PM
  • That works... Thanks

     

    Monday, June 23, 2008 3:12 PM