title: Convert Dataset to XML
body: <p>I've been stuck with this problem for a few hours and can't seem to figure it out, so I'm asking here :)</p>
  
  <p>Alright, I've got this function:</p>
  
  <pre><code>private void XmlDump()
  {
      XDocument doc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"));
      XElement rootElement = new XElement("dump");
      rootElement.Add(TableToX("Support"));
  
      string connectionString = ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString;
      SqlConnection con = new SqlConnection(connectionString);
      string sql = "select * from support";
      SqlDataAdapter da = new SqlDataAdapter(sql, con);
  
      DataSet ds = new DataSet("Test");
      da.Fill(ds, "support");
  
      // Convert dataset to XML here
  
      var docresult = // Converted XML
  
      Response.Write(docResult);
      Response.ContentType = "text/xml; charset=utf-8";
      Response.AddHeader("Content-Disposition", "attachment; filename=test.xml");
      Response.End();
  }
  </code></pre>
  
  <p>I've been trying all kind of different things but I keep getting errors, so I've left the how to convert DataSet to XML part blank.</p>
  
  <p>And another thing, this query contains columns with special characters.</p>