I\'ve been stuck with this problem for a few hours and can\'t seem to figure it out, so I\'m asking here :)
Alright, I\'ve got this function:
private
Write like below code part
DataTable dt = new DataTable("MyData");
dt.WriteXml(@Application.StartupPath + "\\DataBaseValues.xml");
Or, You can convert directly the dataSet also as said by Oded like,
private void WriteXmlToFile(DataSet thisDataSet)
{
if (thisDataSet == null)
{
return;
}
// Create a file name to write to.
string filename = "myXmlDoc.xml";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream(filename, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter);
myXmlWriter.Close();
}