Persisting A Dataset To An XML File : XML Database « Database « C# / C Sharp

Persisting A Dataset To An XML File

 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email:
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
using System;
using System.Data;
using System.Data.OleDb;

namespace Client.Chapter_13___ADO.NET
    public class PersistingADatasetToAnXMLFile
        static void Main(string[] args)
            OleDbConnection MyConnection = new OleDbConnection(@"Provider=Microsft.Jet.OLEDB.4.0; Data Source = c:\MyAccessDB.mdb");
            OleDbDataAdapter MyAdapter = new OleDbDataAdapter("SELECT Column1, Column2, Column3 FROM MyTable", MyConnection);
            DataSet MyDataSet = new DataSet();

            MyAdapter.Fill(MyDataSet, "MyTable");


Related examples in the same category

1.Fill data in DateSet to XmlDocument
2.Obtain an XML Document from a SQL Server Query
3.causes the the child rows to be nested within the parent rows in the output XML
4.illustrates how to write and read XML files
5.Reading An XML File Into A Dataset