q; How to fix this code

G

Guest

Hello,

The following code work but not exactly the way I want. This code gets data
from a table to dataset, update dataset and send it to another method over
web service and write data back to table.

However myTable is not updated but inserted. I would assume it is because of
the line
da.AcceptChangesDuringFill = false;
however if I change that to “true†the web service could not merge this
passed dataset to its own dataset. Any solution to this problem?


da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.AcceptChangesDuringFill = false;
da.Fill(ds, "myTable");

for (int i = 0; i < ds.Tables["myTable"].Rows.Count; i++)
{
ds.Tables["myTable"].Rows["DRR"] = "Test";
}

myWS.Service ws = new myWS.Service();
ws.WSs(ds);

da.Update(ds, "myTable");

dataGridView2.DataSource = ds;
dataGridView2.DataMember = "myTable";


this is what WS does:
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.AcceptChangesDuringFill = false;
da.Fill(ds, "myTable");

// dsSent is the passed ds
ds.Merge(dsSent, false);
da.Update(ds, "myTable");
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top