Export (0) Print
Expand All

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.

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

public ref class DataTableReader sealed : public DbDataReader

The DataTableReader type exposes the following members.

  NameDescription
Public methodSupported by the XNA FrameworkDataTableReader(DataTable)Initializes a new instance of the DataTableReader class by using data from the supplied DataTable.
Public methodSupported by the XNA FrameworkDataTableReader(array<DataTable>)Initializes a new instance of the DataTableReader class using the supplied array of DataTable objects.
Top

  NameDescription
Public propertySupported by the XNA FrameworkDepthThe depth of nesting for the current row of the DataTableReader. (Overrides DbDataReader::Depth.)
Public propertySupported by the XNA FrameworkFieldCountReturns the number of columns in the current row. (Overrides DbDataReader::FieldCount.)
Public propertySupported by the XNA FrameworkHasRowsGets a value that indicates whether the DataTableReader contains one or more rows. (Overrides DbDataReader::HasRows.)
Public propertySupported by the XNA FrameworkIsClosedGets a value that indicates whether the DataTableReader is closed. (Overrides DbDataReader::IsClosed.)
Public propertySupported by the XNA FrameworkItem[Int32]Gets the value of the specified column in its native format given the column ordinal. (Overrides DbDataReader::Item.)
Public propertySupported by the XNA FrameworkItem[String]Gets the value of the specified column in its native format given the column name. (Overrides DbDataReader::Item.)
Public propertySupported by the XNA FrameworkRecordsAffectedGets the number of rows inserted, changed, or deleted by execution of the SQL statement. (Overrides DbDataReader::RecordsAffected.)
Public propertySupported by the XNA FrameworkVisibleFieldCountGets the number of fields in the DbDataReader that are not hidden. (Inherited from DbDataReader.)
Top

  NameDescription
Public methodSupported by the XNA FrameworkCloseCloses the current DataTableReader. (Overrides DbDataReader::Close().)
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkDispose()Releases all resources used by the current instance of the DbDataReader class. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetBooleanGets the value of the specified column as a Boolean. (Overrides DbDataReader::GetBoolean(Int32).)
Public methodSupported by the XNA FrameworkGetByteGets the value of the specified column as a byte. (Overrides DbDataReader::GetByte(Int32).)
Public methodSupported by the XNA FrameworkGetBytesReads 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).)
Public methodSupported by the XNA FrameworkGetCharGets the value of the specified column as a character. (Overrides DbDataReader::GetChar(Int32).)
Public methodSupported by the XNA FrameworkGetCharsReturns the value of the specified column as a character array. (Overrides DbDataReader::GetChars(Int32, Int64, array<Char>, Int32, Int32).)
Public methodSupported by the XNA FrameworkGetDataReturns a DbDataReader object for the requested column ordinal. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkGetDataTypeNameGets a string representing the data type of the specified column. (Overrides DbDataReader::GetDataTypeName(Int32).)
Public methodSupported by the XNA FrameworkGetDateTimeGets the value of the specified column as a DateTime object. (Overrides DbDataReader::GetDateTime(Int32).)
Public methodSupported by the XNA FrameworkGetDecimalGets the value of the specified column as a Decimal. (Overrides DbDataReader::GetDecimal(Int32).)
Public methodSupported by the XNA FrameworkGetDoubleGets the value of the column as a double-precision floating point number. (Overrides DbDataReader::GetDouble(Int32).)
Public methodSupported by the XNA FrameworkGetEnumeratorReturns an enumerator that can be used to iterate through the item collection. (Overrides DbDataReader::GetEnumerator().)
Public methodSupported by the XNA FrameworkGetFieldTypeGets the Type that is the data type of the object. (Overrides DbDataReader::GetFieldType(Int32).)
Public methodGetFieldValue<T>Synchronously gets the value of the specified column as a type. (Inherited from DbDataReader.)
Public methodGetFieldValueAsync<T>(Int32)Asynchronously gets the value of the specified column as a type. (Inherited from DbDataReader.)
Public methodGetFieldValueAsync<T>(Int32, CancellationToken)Asynchronously gets the value of the specified column as a type. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkGetFloatGets the value of the specified column as a single-precision floating point number. (Overrides DbDataReader::GetFloat(Int32).)
Public methodSupported by the XNA FrameworkGetGuidGets the value of the specified column as a globally-unique identifier (GUID). (Overrides DbDataReader::GetGuid(Int32).)
Public methodSupported by the XNA FrameworkGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetInt16Gets the value of the specified column as a 16-bit signed integer. (Overrides DbDataReader::GetInt16(Int32).)
Public methodSupported by the XNA FrameworkGetInt32Gets the value of the specified column as a 32-bit signed integer. (Overrides DbDataReader::GetInt32(Int32).)
Public methodSupported by the XNA FrameworkGetInt64Gets the value of the specified column as a 64-bit signed integer. (Overrides DbDataReader::GetInt64(Int32).)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkGetNameGets the value of the specified column as a String. (Overrides DbDataReader::GetName(Int32).)
Public methodSupported by the XNA FrameworkGetOrdinalGets the column ordinal, given the name of the column. (Overrides DbDataReader::GetOrdinal(String).)
Public methodSupported by the XNA FrameworkGetProviderSpecificFieldTypeGets the type of the specified column in provider-specific format. (Overrides DbDataReader::GetProviderSpecificFieldType(Int32).)
Public methodSupported by the XNA FrameworkGetProviderSpecificValueGets the value of the specified column in provider-specific format. (Overrides DbDataReader::GetProviderSpecificValue(Int32).)
Public methodSupported by the XNA FrameworkGetProviderSpecificValuesFills the supplied array with provider-specific type information for all the columns in the DataTableReader. (Overrides DbDataReader::GetProviderSpecificValues(array<Object>).)
Public methodSupported by the XNA FrameworkGetSchemaTableReturns a DataTable that describes the column metadata of the DataTableReader. (Overrides DbDataReader::GetSchemaTable().)
Public methodGetStreamRetrieves data as a Stream. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkGetStringGets the value of the specified column as a string. (Overrides DbDataReader::GetString(Int32).)
Public methodGetTextReaderRetrieves data as a TextReader. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetValueGets the value of the specified column in its native format. (Overrides DbDataReader::GetValue(Int32).)
Public methodSupported by the XNA FrameworkGetValuesPopulates an array of objects with the column values of the current row. (Overrides DbDataReader::GetValues(array<Object>).)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkIsDBNullGets a value that indicates whether the column contains non-existent or missing values. (Overrides DbDataReader::IsDBNull(Int32).)
Public methodIsDBNullAsync(Int32)An asynchronous version of IsDBNull, which gets a value that indicates whether the column contains non-existent or missing values. (Inherited from DbDataReader.)
Public methodIsDBNullAsync(Int32, CancellationToken)An asynchronous version of IsDBNull, which gets a value that indicates whether the column contains non-existent or missing values. Optionally, sends a notification that operations should be cancelled. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkNextResultAdvances the DataTableReader to the next result set, if any. (Overrides DbDataReader::NextResult().)
Public methodNextResultAsync()An asynchronous version of NextResult, which advances the reader to the next result when reading the results of a batch of statements.Invokes NextResultAsync with CancellationToken.None. (Inherited from DbDataReader.)
Public methodNextResultAsync(CancellationToken)This is the asynchronous version of NextResult. Providers should override with an appropriate implementation. The cancellationToken may optionally be ignored.The default implementation invokes the synchronous NextResult method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by NextResult will be communicated via the returned Task Exception property.Other methods and properties of the DbDataReader object should not be invoked while the returned Task is not yet completed. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkReadAdvances the DataTableReader to the next record. (Overrides DbDataReader::Read().)
Public methodReadAsync()An asynchronous version of Read, which advances the reader to the next record in a result set. This method invokes ReadAsync with CancellationToken.None. (Inherited from DbDataReader.)
Public methodReadAsync(CancellationToken)This is the asynchronous version of Read. Providers should override with an appropriate implementation. The cancellationToken may optionally be ignored.The default implementation invokes the synchronous Read method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by Read will be communicated via the returned Task Exception property.Do not invoke other methods and properties of the DbDataReader object until the returned Task is complete. (Inherited from DbDataReader.)
Public methodSupported by the XNA FrameworkToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDataRecord::GetDataFor a description of this member, see IDataRecord::GetData. (Inherited from DbDataReader.)
Top

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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

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