Applying changes to table

  • Thread starter Thread starter Anthony Malt
  • Start date Start date
A

Anthony Malt

Hi,

my client sends a dataset with changes to my server. These changes have been
created by the GetChanges method of the dataset.

What's the easiest way to update the table on the server with these changes?
What a Stored Procedure look like to do this?

Thanks for any advice in advance
Anthony
 
Anthony,

Use the dataadapter update method.

Be aware that the GetChanges creates a copy of the changed rows of the
dataset. Without a acceptchanges from the original dataset after the
successful done update you are mostly in trouble.

http://msdn.microsoft.com/library/d...stemdatasqlclientsqldataadapterclasstopic.asp

For that you have to create the proper insert, update and delete command,
for which you can use a commandbuilder or do it by hand. Be aware that you
set the sql code to check the optimistic concurrency the meanwhile updated
datarows by others.

If the SQL statements are dynamic or in an stored procedure is not the most
important part from this. If you don't use the commandbuilder than I would
first try it dynamic (because it is not the simplest part) and than place
those commands in a stored procedure.

I hope this helps,

Cor
 
Back
Top