title: Convert datatable into XML
body: <p>I convert XML into datatable and now want to convert data table into XML again.
  I have database in which four XML's are there and have to change that text xml</p>
  
  <pre><code>public ActionResult getChangeContent(string arg, string content)
  {
      char[] a = { ':' };
      string[] id = arg.Split(a);
      decimal tid = Convert.ToDecimal(id[0]);
      decimal jid = Convert.ToDecimal(id[1]);
      string groupname = id[2];
      var gp = (from Trans_Mast in r2ge.Transcription_Master where Trans_Mast.Transcription_Id == tid &amp;&amp; Trans_Mast.Entity_Id == jid select Trans_Mast).Distinct();
  
      foreach (var g in gp)
      {
          DataSet ds = new DataSet();
          ds.ReadXml(new XmlTextReader(new StringReader(g.Text_xml)));
          DataTable text = ds.Tables[0];
  
          for (int i = 0; i &lt; text.Rows.Count; i++)
          {
              if (text.Rows[i]["group"].Equals(groupname))
              {
                  text.Rows[i]["Text_Text"] = content;
              }
              text.AcceptChanges();
          }
          ConvertDatatableToXML(text);
      }
      return View();
  }
  
  public string ConvertDatatableToXML(DataTable dtTemp)
  {
      MemoryStream str = new MemoryStream();
      dtTemp.WriteXml(str, true);
      str.Seek(0, SeekOrigin.Begin);
      StreamReader sr = new StreamReader(str);
      string xmlstr;
      xmlstr = sr.ReadToEnd();
      return (xmlstr);
  }
  </code></pre>
  
  <p>Data set is changed but there is no affect on XML.. any suggestion please..</p>