if (this.MyData == null) this.MyData = new MyDataSet(); XML = this.oWS.GetMyData(this.MyKey); this.MyData.FillWithXml(XML);The .FillWithXML() method is a method we have on all our Typed DataSets. It simply does this:
StringReader sr = new StringReader(XML); this.ReadXml(sr, XmlReadMode.InferSchema); this.AcceptChanges();Your WebService method does whatever it needs to do to get the data and simply returns MyDataSet.GetXml().
DataSet dsChanged = this.MyData.GetChanges(); DataSet dsDeleted = this.MyData.GetChanges(DataRowState.Deleted); ChangeXML = dsChanged.GetXml(); if (dsDeleted != null) { // -- The dsDeleted DataSet contains only the deleted rows // However, since the GetXML() method ignores the Deleted // rows we need to un-delete them first. // dsDeleted.RejectChanges(); DeleteXML = dsDeleted.GetXml(); } else DeleteXML = ""; // This is a simplistic view. There would be more stuff you might need // to do as far as matching keys and stuff like that. if (this.oWS.SaveMyData(ChangeXML, DeleteXML)) this.MyData.AcceptChanges();The WebService SaveMyData() method would be something like this:
[WebMethod(Description="Saves info for one MyData entity")] public bool SaveMyData(string ChangeXML, string DeleteXML) { MyDataSet dsChanged = new MyDataSet(); MyDataSet dsDeleted = new MyDataSet(); try { dsChanged.FillWithXml(ChangeXML); if (DeleteXML != "") dsDeleted.FillWithXml(DeleteXML); } catch (Exception ex) { return false; } bool IsOK = true; // do all your processing for saving // (call your Biz class or DataAccess class) return IsOK; }Does this help?