DataTableReader Class
The DataTableReader obtains the contents of one or more DataTable objects in the form of one or more read-only, forward-only result sets.
System::MarshalByRefObject
System.Data.Common::DbDataReader
System.Data::DataTableReader
Assembly: System.Data (in System.Data.dll)
The DataTableReader type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | DataTableReader(DataTable) | Initializes a new instance of the DataTableReader class by using data from the supplied DataTable. |
![]() ![]() | DataTableReader(array<DataTable>) | Initializes a new instance of the DataTableReader class using the supplied array of DataTable objects. |
| Name | Description | |
|---|---|---|
![]() ![]() | Depth | The depth of nesting for the current row of the DataTableReader. (Overrides DbDataReader::Depth.) |
![]() ![]() | FieldCount | Returns the number of columns in the current row. (Overrides DbDataReader::FieldCount.) |
![]() ![]() | HasRows | Gets a value that indicates whether the DataTableReader contains one or more rows. (Overrides DbDataReader::HasRows.) |
![]() ![]() | IsClosed | Gets a value that indicates whether the DataTableReader is closed. (Overrides DbDataReader::IsClosed.) |
![]() ![]() | Item[Int32] | Gets the value of the specified column in its native format given the column ordinal. (Overrides DbDataReader::Item[Int32].) |
![]() ![]() | Item[String] | Gets the value of the specified column in its native format given the column name. (Overrides DbDataReader::Item[String].) |
![]() ![]() | RecordsAffected | Gets the number of rows inserted, changed, or deleted by execution of the SQL statement. (Overrides DbDataReader::RecordsAffected.) |
![]() ![]() | VisibleFieldCount | Gets the number of fields in the DbDataReader that are not hidden. (Inherited from DbDataReader.) |
| Name | Description | |
|---|---|---|
![]() ![]() | Close | Closes the current DataTableReader. (Overrides DbDataReader::Close().) |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() ![]() | Dispose() | Releases all resources used by the current instance of the DbDataReader class. (Inherited from DbDataReader.) |
![]() ![]() | Dispose(Boolean) | Releases the managed resources used by the DbDataReader and optionally releases the unmanaged resources. (Inherited from DbDataReader.) |
![]() ![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetBoolean | Gets the value of the specified column as a Boolean. (Overrides DbDataReader::GetBoolean(Int32).) |
![]() ![]() | GetByte | Gets the value of the specified column as a byte. (Overrides DbDataReader::GetByte(Int32).) |
![]() ![]() | GetBytes | Reads a stream of bytes starting at the specified column offset into the buffer as an array starting at the specified buffer offset. (Overrides DbDataReader::GetBytes(Int32, Int64, array<Byte>, Int32, Int32).) |
![]() ![]() | GetChar | Gets the value of the specified column as a character. (Overrides DbDataReader::GetChar(Int32).) |
![]() ![]() | GetChars | Returns the value of the specified column as a character array. (Overrides DbDataReader::GetChars(Int32, Int64, array<Char>, Int32, Int32).) |
![]() ![]() | GetData | Returns a DbDataReader object for the requested column ordinal. (Inherited from DbDataReader.) |
![]() ![]() | GetDataTypeName | Gets a string representing the data type of the specified column. (Overrides DbDataReader::GetDataTypeName(Int32).) |
![]() ![]() | GetDateTime | Gets the value of the specified column as a DateTime object. (Overrides DbDataReader::GetDateTime(Int32).) |
![]() ![]() | GetDbDataReader | Returns a DbDataReader object for the requested column ordinal that can be overridden with a provider-specific implementation. (Inherited from DbDataReader.) |
![]() ![]() | GetDecimal | Gets the value of the specified column as a Decimal. (Overrides DbDataReader::GetDecimal(Int32).) |
![]() ![]() | GetDouble | Gets the value of the column as a double-precision floating point number. (Overrides DbDataReader::GetDouble(Int32).) |
![]() ![]() | GetEnumerator | Returns an enumerator that can be used to iterate through the item collection. (Overrides DbDataReader::GetEnumerator().) |
![]() ![]() | GetFieldType | Gets the Type that is the data type of the object. (Overrides DbDataReader::GetFieldType(Int32).) |
![]() ![]() | GetFloat | Gets the value of the specified column as a single-precision floating point number. (Overrides DbDataReader::GetFloat(Int32).) |
![]() ![]() | GetGuid | Gets the value of the specified column as a globally-unique identifier (GUID). (Overrides DbDataReader::GetGuid(Int32).) |
![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetInt16 | Gets the value of the specified column as a 16-bit signed integer. (Overrides DbDataReader::GetInt16(Int32).) |
![]() ![]() | GetInt32 | Gets the value of the specified column as a 32-bit signed integer. (Overrides DbDataReader::GetInt32(Int32).) |
![]() ![]() | GetInt64 | Gets the value of the specified column as a 64-bit signed integer. (Overrides DbDataReader::GetInt64(Int32).) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() ![]() | GetName | Gets the value of the specified column as a String. (Overrides DbDataReader::GetName(Int32).) |
![]() ![]() | GetOrdinal | Gets the column ordinal, given the name of the column. (Overrides DbDataReader::GetOrdinal(String).) |
![]() ![]() | GetProviderSpecificFieldType | Gets the type of the specified column in provider-specific format. (Overrides DbDataReader::GetProviderSpecificFieldType(Int32).) |
![]() ![]() | GetProviderSpecificValue | Gets the value of the specified column in provider-specific format. (Overrides DbDataReader::GetProviderSpecificValue(Int32).) |
![]() ![]() | GetProviderSpecificValues | Fills the supplied array with provider-specific type information for all the columns in the DataTableReader. (Overrides DbDataReader::GetProviderSpecificValues(array<Object>).) |
![]() ![]() | GetSchemaTable | Returns a DataTable that describes the column metadata of the DataTableReader. (Overrides DbDataReader::GetSchemaTable().) |
![]() ![]() | GetString | Gets the value of the specified column as a string. (Overrides DbDataReader::GetString(Int32).) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | GetValue | Gets the value of the specified column in its native format. (Overrides DbDataReader::GetValue(Int32).) |
![]() ![]() | GetValues | Populates an array of objects with the column values of the current row. (Overrides DbDataReader::GetValues(array<Object>).) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() ![]() | IsDBNull | Gets a value that indicates whether the column contains non-existent or missing values. (Overrides DbDataReader::IsDBNull(Int32).) |
![]() ![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() ![]() | NextResult | Advances the DataTableReader to the next result set, if any. (Overrides DbDataReader::NextResult().) |
![]() ![]() | Read | Advances the DataTableReader to the next record. (Overrides DbDataReader::Read().) |
![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | IDataRecord::GetData | For a description of this member, see IDataRecord::GetData. (Inherited from 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 structure of the returned result is identical 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 DataSet contains more than one table. The results are in the same sequence as the DataTable objects 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 size of 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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
