System.Data.DataTableReader Class

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

See Also: DataTableReader Members

Syntax

public sealed class DataTableReader : System.Data.Common.DbDataReader

Remarks

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

When you create a System.Data.DataTableReader from a System.Data.DataTable, the resulting System.Data.DataTableReader object contains one result set with the same data as the System.Data.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 System.Data.DataTable. The structure of the returned result is identical in schema and data to the original System.Data.DataTable. A System.Data.DataTableReader that was created by calling the DataSet.GetDataReader method of a System.Data.DataSet object contains multiple result sets if the System.Data.DataSet contains more than one table. The results are in the same sequence as the System.Data.DataTable objects in the System.Data.DataTableCollection of the System.Data.DataSet object.

The returned result set contains only the current version of each System.Data.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 size of the underlying collection is modified during iteration. For example, if one or more rows in the DataTable.Rows collection are deleted or removed during iteration, the current position within the DataTableReader is maintained appropriately and it does not invalidate the iterator.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0