DataSet Property
Collapse the table of content
Expand the table of content

XmlDataDocument.DataSet Property


Gets a DataSet that provides a relational representation of the data in the XmlDataDocument.

Namespace:   System.Xml
Assembly:  System.Data (in System.Data.dll)

public DataSet DataSet { get; }

Property Value

Type: System.Data.DataSet

A DataSet that can be used to access the data in the XmlDataDocument using a relational model.

The DataSet enables you to access the data in the XmlDataDocument using a relational model. This means that you can handle the data as tables and views, rows and columns, relations, and so on. Changes made in the DataSet are immediately visible in the XmlDataDocument.

The following example modifies the price of a book using the DataSet methods.

using System;
using System.Data;
using System.Xml;

public class Sample
  public static void Main()
     //Create an XmlDataDocument.
     XmlDataDocument doc = new XmlDataDocument();

     //Load the schema file.

     //Load the XML data.

     //Update the price on the first book using the DataSet methods.
     DataTable books = doc.DataSet.Tables["book"];
     books.Rows[0]["price"] = "12.95";  

     Console.WriteLine("Display the modified XML data...");
} // End class

The example uses the following two files as input.



.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft