Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / January 2006

Tip: Looking for answers? Try searching our database.

Applying changes to table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anthony Malt - 16 Jan 2006 12:39 GMT
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

Signature

Anthony Malt

Joe - 16 Jan 2006 13:27 GMT
Dear Anthony Malt,

A stored procedure example for insert as the following:
--------------------------------------------------------------------
CREATE PROCEDURE StoredName
(@VarName1 VarType, @VarName2 VarType) AS

INSERT Into TableName VALUES(@VarName1, @VarName2)
--------------------------------------------------------------------

Hope can help you,
Regards
Joe Tsui

> Hi,
>
[quoted text clipped - 6 lines]
> Thanks for any advice in advance
> Anthony
Cor Ligthert [MVP] - 16 Jan 2006 16:05 GMT
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/default.asp?url=/library/en-us/cpref/html/frlr
fsystemdatasqlclientsqldataadapterclasstopic.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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.