DataSet.ReadXml : DataSet « System.Data « C# / C Sharp by API






DataSet.ReadXml

  


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);
    }
}

   
    
  








Related examples in the same category

1.new DataSet(String data)
2.DataSet.Delete
3.DataSet.Merge
4.DataSet.MergeFailed
5.DataSet.Read
6.DataSet.Relations.Add
7.DataSet.Tables
8.DataSet.WriteXml