472,791 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

Issue passing DataSet as XML from WebService

Hello,
I have a WebService that sends a client a DataSet as XML (I use a
DataSet.GetXml to get the XML). The DataSet is filled by a DataAdapter
in the WebService. The client coverts the XML Back to a DataSet (using
StringReader sr = new StringReader(xml); DataSet ds = new DataSet();
ds.ReadXml(sr)).
The client then makes changes to this DataSet, and sends the dirty dataset
back to the WebService using another GetXml on 'ds'.

The WebService re-converts the xml into a DataSet (using a DataSet ds = new
DataSet(); ds.ReadXml; )and executes a DataAdapter.Update(ds).

The problem is, all the rows in the dirty dataset passed back from the
client get appended to the DataBase with new primary keys (the primary key
field is autogenerated in the database) (instead of only the dirty rows
getting updated.) Am I doing something wrong?

Please help.

Best,
Andy

Nov 12 '05 #1
1 4248
Do something like this:
DataSet ds = new DataSet();
ds.ReadXml("datafromserver.xml");
ds.AcceptChanges(); // accept all this data

// then make your edits, and write out just the new stufff:

DataSet diff = ds.GetChanges();
diff.WriteXml(@"..\..\diff.xml", XmlWriteMode.DiffGram);

// and send that back to the server

On the server you can merge the changes in using the Merge method.
"Andy" <av*****@e-470.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,
I have a WebService that sends a client a DataSet as XML (I use a
DataSet.GetXml to get the XML). The DataSet is filled by a DataAdapter
in the WebService. The client coverts the XML Back to a DataSet (using
StringReader sr = new StringReader(xml); DataSet ds = new DataSet();
ds.ReadXml(sr)).
The client then makes changes to this DataSet, and sends the dirty dataset
back to the WebService using another GetXml on 'ds'.

The WebService re-converts the xml into a DataSet (using a DataSet ds = new DataSet(); ds.ReadXml; )and executes a DataAdapter.Update(ds).

The problem is, all the rows in the dirty dataset passed back from the
client get appended to the DataBase with new primary keys (the primary key
field is autogenerated in the database) (instead of only the dirty rows
getting updated.) Am I doing something wrong?

Please help.

Best,
Andy

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
1
by: kai | last post by:
Hi, All I try to use a Webservice CustomerOrderHistory to get customer order by passing a "CustomerID". The Webservice works but the following code Dim ds1 As DataSet Dim CustomerID As...
2
by: john | last post by:
Hello, We have a tablet pc that is trying to sync data to our main sql server during the night but we keep getting a timeout issue. The tablet pc has an access database that contains about 5000...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
1
by: Deecrypt | last post by:
Hi, Passing a string parameter to a webservice to get the dataset generated as the result, seems to give me an error suggesting that no parameter is being passed. However it works if I explicitly...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.