Persist a Dataset to an XML file : DataSet Xml : ADO.Net C# Examples


C# Examples » ADO.Net » DataSet Xml »

 

Persist a Dataset to an XML file









    
using  System;
using  System.Data;
using  System.Data.OleDb;

class  MainClass
{
    static  void  Main(string[]  args)
    {                                                                                                              
        OleDbConnection  MyConnection  =  new  OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;  Data  Source  =  c:\\Northwind.mdb");
        OleDbDataAdapter  MyAdapter  =  new  OleDbDataAdapter("SELECT  *  FROM  orders",  MyConnection);
        DataSet  MyDataSet  =  new  DataSet();

        MyAdapter.Fill(MyDataSet,  "orders");
        MyDataSet.WriteXml(@"c:\Sample.xml");
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo ADO.Net
» DataSet Xml