示例#1
0
    private static void LogErrorXml(XmlDataDocument _XmlDataDocument)
    {
      _XmlFileMutex.WaitOne();

      string m_LogName = InnerXmlFileName.Replace(".txt", DateTime.Now.Ticks.ToString()) + ".html";
      CheckDirectory(m_LogName);
      XmlTextWriter xmlWriter = new XmlTextWriter(m_LogName, Encoding.ASCII);
      xmlWriter.Formatting = Formatting.Indented;
      _XmlDataDocument.WriteTo(xmlWriter);
      xmlWriter.Flush();
      xmlWriter.Close();
      _XmlFileMutex.ReleaseMutex();
    }
		private void btnSave_Click(object sender, System.EventArgs e)
		{
			// Create an XmlDataDocument from the DataSet
			XmlDataDocument xdd = new XmlDataDocument((DataSet) dgCustomers.DataSource);
			// And save it to a disk file
			XmlTextWriter xtw = new XmlTextWriter(@"c:\temp\FranceCust.xml", System.Text.Encoding.UTF8);
			xdd.WriteTo(xtw);
			xtw.Flush();
			xtw.Close();
			MessageBox.Show(@"Wrote file c:\temp\FranceCust.xml");
		}