Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving DiffGrams
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00738131
Message ID:
00738159
Views:
17
Hi Stephane,

You are actually trying to update an updategram instead of a diffgram. To update this, you need to install the the SqlXml 3.0 package and use the SqlXMLCommand object.

Here is some sample code on how to use this in ADO.NET:
SqlXmlCommand objSXC = new SqlXmlCommand("Driver={SQL
Server};Server=MyServer;Database=MyDatabase;Uid=MyUser; Pwd=MyPassword;");

objSXC.CommandType = SqlXmlCommandType.UpdateGram;

objSXC.CommandText = MyXMLstring;

objSXC.ExecuteNonQuery ();
Here is the link to download SqlXml 3.0:

http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/824/msdncompositedoc.xml

>How do i save a Diffgram back to SQL Server using ADO.NET and C#? Here is the diffgram i want to save:
>
>
>
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><root xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
>	<updg:sync>
>		<updg:before>
>			<testtable>
>				<descr>BEFORE CHANGE</descr>
>				<identity_column>5</identity_column>
>			</testtable>
>		</updg:before>
>		<updg:after>
>			<testtable>
>				<descr>AFTER CHANGE</descr>
>				<identity_column>5</identity_column>
>			</testtable>
>		</updg:after>
>	</updg:sync>
></root>
>
>
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform