Dataset Object Model: Using XML in A Dataset Dataset
Dataset Object Model: Using XML in A Dataset Dataset
NET DataSets
ADO.NET DataSet
It is a collection of data tables that contain the data. It is used to fetch data without interacting
with a Data Source that's why, it also known as disconnected data access method. It is an in-
memory data store that can hold more than one table at the same time. We can use DataRelation
object to relate these tables. The DataSet can also be used to read and write data as XML
document.ADO.NET provides a DataSet class that can be used to create DataSet object. It
contains constructors and methods to perform data related operations.
The DataSet object is central to supporting disconnected, distributed data scenarios with
ADO.NET. The DataSet is a memory-resident representation of data that provides a consistent
relational programming model regardless of the data source. It can be used with multiple and
differing data sources, with XML data, or to manage data local to the application.
The DataSet represents a complete set of data, including related tables, constraints, and
relationships among the tables. The following illustration shows the DataSet object model.
DataTables
DataSet is made up of a collection of tables, relationships, and constraints. In
ADO.NET, DataTable objects are used to represent the tables in a DataSet.
A DataTable represents one table of in-memory relational data; the data is local to the
.NET-based application in which it resides, but can be populated from a data source
such as Microsoft SQL Server using a DataAdapter For more information,
see Populating a DataSet from a DataAdapter.
A DataRow represent a row of data in data table. You add data to the data table using DataRow
object. A DataRowCollection object represents a collection of data rows of a data table. You use
DataTable's NewRow method to return a DataRow object of data table, add values to the data
row and add a row to the data Table again by using DataRowCollection's Add method.
The DataTableCollection
An ADO.NET DataSet contains a collection of zero or more tables represented
by DataTable objects. The DataTableCollection contains all the DataTable objects in a DataSet.
A DataTable is defined in the System.Data namespace and represents a single table of memory-
resident data. It contains a collection of columns represented by a DataColumnCollection, and
constraints represented by a ConstraintCollection, which together define the schema of the table.
A DataTable also contains a collection of rows represented by the DataRowCollection, which
contains the data in the table. Along with its current state, a DataRow retains both its current and
original versions to identify changes to the values stored in the row.