tags:

views:

43

answers:

1

Hey,

What is the most effective way to add new items to my DataSet, and making sure that if it's an duplicate item, that I update it instead of creating a new entry?

If I was writing this in mySQL I would use the 'On Duplicate' syntax.

+3  A: 

Use the DataSet.Merge method. It has overloads that allow you to specify how the merge should performed, preserve or ignore changes, and how to treat new columns.

Also, if you want the merge to be effective, ensure that you have a primary key on all tables, because the DataSet builds an index over all the rows using the primary key. (Internally it's an RBTree)

Pop Catalin
Thanks, Pop Catalin. I think this may have been what I was looking for.
Fuji