Applying changes to table

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
 
C

Cor Ligthert [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top