Comments/Troubleshooting
The
DataTable
class provides a consistent programming
model regardless of the actual data source. The
DataTable
contains DataColumn
and Constraint
objects that define the schema of
the data represented. The actual data is stored as a collection of
DataRows
within the DataTable
.
The schema of the DataTable
can be created
entirely programmatically, retrieved as the result of a query against
a data source using a .NET managed data provider or loaded from an
XML document or stream through the DataSet
the
DataTable
belongs to.
The data in the DataTable
can be populated from
the data source, modified, and later reconciled back to a data source
using a DataAdapter
. Alternatively, the data can
be populated from XML documents or streams, modified, and saved as an
XML document or stream through the DataSet
the
DataTable
belongs to. Finally, the data stored in
the DataTable
can be manipulated programmatically.
There are similarities between the DataTable
and
the DataReader
in that they both can store the
results of a query, which can then be accessed through row and column
objects. The primary difference is that the
DataTable
is a disconnected class that places
little restriction on how the data within it is accessed and allows
that data to be filtered, sorted, and modified; the
DataReader
is a connected class that provides
little functionality beyond forward-only, read-only access to the
result set, one row at a time.
The commonly used public properties of the
DataTable ...
Get ADO.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.