DataTableReader Class

Note: This class is new in the .NET Framework version 2.0.

The DataTableReader obtains the contents of one or more DataTable objects in the form of one or more read-only, forward-only result sets.

Namespace: System.Data
Assembly: System.Data (in

public ref class DataTableReader sealed : public DbDataReader
public final class DataTableReader extends DbDataReader
public final class DataTableReader extends DbDataReader

The DataTableReader works much like any other data reader, such as the SqlDataReader, except that the DataTableReader provides for iterating over rows in a DataTable. In other words, it provides for iterating over rows in a cache. The cached data can be modified while the DataTableReader is active, and the reader automatically maintains its position.

When you create a DataTableReader from a DataTable, the resulting DataTableReader object contains one result set with the same data as the DataTable from which it was created, except for any rows that have been marked as deleted. The columns appear in the same order as in the original DataTable. The returned result is isomorphic in schema and data to the original DataTable. A DataTableReader that was created by calling the GetDataReader method of a DataSet object contains multiple result sets if the DataSetcontains more than one table. The results are in the same sequence as the DataTableobjects in the DataTableCollection of the DataSet object.

The returned result set contains only the current version of each DataRow; rows that are marked for deletion are skipped.

The DataTableReader provides a stable iterator; that is, the contents of the DataTableReader are not invalidated if the underlying collection is modified during iteration. For example, if one or more rows in the Rows collection are deleted or removed during iteration, the current position within the DataTableReader is maintained appropriately and it does not invalidate the iterator.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0

Community Additions