Reading XML with DataSet : Xml DataSet « XML « C# / CSharp Tutorial






using System;
using System.Data;
using System.Collections.Generic;
using System.Text;


  class Program
  {
    static void Main(string[] args)
    {
      DataSet thisDataSet = new DataSet();
      thisDataSet.ReadXml("nwinddata.xml");
      foreach (DataRow custRow in thisDataSet.Tables["Customers"].Rows)
      {
        Console.WriteLine("Customer ID: " + custRow["CustomerID"] +
                  " Name: " + custRow["CompanyName"]);
      }

      Console.WriteLine("Table created by ReadXml is called {0}",
                 thisDataSet.Tables[0].TableName);
    }
  }








30.28.Xml DataSet
30.28.1.Fill DataSet with the data from XML
30.28.2.Load XML to DataSet
30.28.3.Save data in a DataSet to xml document
30.28.4.Create Data with DataSet and DataRow and save to xml
30.28.5.Output DataSet to Xml
30.28.6.Reading XML with DataSet