0 out of 1 rated this helpful - Rate this topic

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.Object
  System.MarshalByRefObject
    System.Data.Common.DbDataReader
      System.Data.DataTableReader

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)
public sealed class DataTableReader : DbDataReader

The DataTableReader type exposes the following members.

  Name Description
Public method Supported by the XNA Framework DataTableReader(DataTable) Initializes a new instance of the DataTableReader class by using data from the supplied DataTable.
Public method Supported by the XNA Framework DataTableReader(DataTable[]) Initializes a new instance of the DataTableReader class using the supplied array of DataTable objects.
Top
  Name Description
Public property Supported by the XNA Framework Depth The depth of nesting for the current row of the DataTableReader. (Overrides DbDataReader.Depth.)
Public property Supported by the XNA Framework FieldCount Returns the number of columns in the current row. (Overrides DbDataReader.FieldCount.)
Public property Supported by the XNA Framework HasRows Gets a value that indicates whether the DataTableReader contains one or more rows. (Overrides DbDataReader.HasRows.)
Public property Supported by the XNA Framework IsClosed Gets a value that indicates whether the DataTableReader is closed. (Overrides DbDataReader.IsClosed.)
Public property Supported by the XNA Framework Item[Int32] Gets the value of the specified column in its native format given the column ordinal. (Overrides DbDataReader.Item[Int32].)
Public property Supported by the XNA Framework Item[String] Gets the value of the specified column in its native format given the column name. (Overrides DbDataReader.Item[String].)
Public property Supported by the XNA Framework RecordsAffected Gets the number of rows inserted, changed, or deleted by execution of the SQL statement. (Overrides DbDataReader.RecordsAffected.)
Public property Supported by the XNA Framework VisibleFieldCount Gets the number of fields in the DbDataReader that are not hidden. (Inherited from DbDataReader.)
Top
  Name Description
Public method Supported by the XNA Framework Close Closes the current DataTableReader. (Overrides DbDataReader.Close().)
Public method 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.)
Public method Supported by the XNA Framework Dispose() Releases all resources used by the current instance of the DbDataReader class. (Inherited from DbDataReader.)
Protected method Supported by the XNA Framework Dispose(Boolean) Releases the managed resources used by the DbDataReader and optionally releases the unmanaged resources. (Inherited from DbDataReader.)
Public method Supported by the XNA Framework Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Supported by the XNA Framework Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method Supported by the XNA Framework GetBoolean Gets the value of the specified column as a Boolean. (Overrides DbDataReader.GetBoolean(Int32).)
Public method Supported by the XNA Framework GetByte Gets the value of the specified column as a byte. (Overrides DbDataReader.GetByte(Int32).)
Public method Supported by the XNA Framework 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, Byte[], Int32, Int32).)
Public method Supported by the XNA Framework GetChar Gets the value of the specified column as a character. (Overrides DbDataReader.GetChar(Int32).)
Public method Supported by the XNA Framework GetChars Returns the value of the specified column as a character array. (Overrides DbDataReader.GetChars(Int32, Int64, Char[], Int32, Int32).)
Public method Supported by the XNA Framework GetData Returns a DbDataReader object for the requested column ordinal. (Inherited from DbDataReader.)
Public method Supported by the XNA Framework GetDataTypeName Gets a string representing the data type of the specified column. (Overrides DbDataReader.GetDataTypeName(Int32).)
Public method Supported by the XNA Framework GetDateTime Gets the value of the specified column as a DateTime object. (Overrides DbDataReader.GetDateTime(Int32).)
Protected method Supported by the XNA Framework GetDbDataReader Returns a DbDataReader object for the requested column ordinal that can be overridden with a provider-specific implementation. (Inherited from DbDataReader.)
Public method Supported by the XNA Framework GetDecimal Gets the value of the specified column as a Decimal. (Overrides DbDataReader.GetDecimal(Int32).)
Public method Supported by the XNA Framework GetDouble Gets the value of the column as a double-precision floating point number. (Overrides DbDataReader.GetDouble(Int32).)
Public method Supported by the XNA Framework GetEnumerator Returns an enumerator that can be used to iterate through the item collection. (Overrides DbDataReader.GetEnumerator().)
Public method Supported by the XNA Framework GetFieldType Gets the Type that is the data type of the object. (Overrides DbDataReader.GetFieldType(Int32).)
Public method Supported by the XNA Framework GetFloat Gets the value of the specified column as a single-precision floating point number. (Overrides DbDataReader.GetFloat(Int32).)
Public method Supported by the XNA Framework GetGuid Gets the value of the specified column as a globally-unique identifier (GUID). (Overrides DbDataReader.GetGuid(Int32).)
Public method Supported by the XNA Framework GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method Supported by the XNA Framework GetInt16 Gets the value of the specified column as a 16-bit signed integer. (Overrides DbDataReader.GetInt16(Int32).)
Public method Supported by the XNA Framework GetInt32 Gets the value of the specified column as a 32-bit signed integer. (Overrides DbDataReader.GetInt32(Int32).)
Public method Supported by the XNA Framework GetInt64 Gets the value of the specified column as a 64-bit signed integer. (Overrides DbDataReader.GetInt64(Int32).)
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method Supported by the XNA Framework GetName Gets the value of the specified column as a String. (Overrides DbDataReader.GetName(Int32).)
Public method Supported by the XNA Framework GetOrdinal Gets the column ordinal, given the name of the column. (Overrides DbDataReader.GetOrdinal(String).)
Public method Supported by the XNA Framework GetProviderSpecificFieldType Gets the type of the specified column in provider-specific format. (Overrides DbDataReader.GetProviderSpecificFieldType(Int32).)
Public method Supported by the XNA Framework GetProviderSpecificValue Gets the value of the specified column in provider-specific format. (Overrides DbDataReader.GetProviderSpecificValue(Int32).)
Public method Supported by the XNA Framework GetProviderSpecificValues Fills the supplied array with provider-specific type information for all the columns in the DataTableReader. (Overrides DbDataReader.GetProviderSpecificValues(Object[]).)
Public method Supported by the XNA Framework GetSchemaTable Returns a DataTable that describes the column metadata of the DataTableReader. (Overrides DbDataReader.GetSchemaTable().)
Public method Supported by the XNA Framework GetString Gets the value of the specified column as a string. (Overrides DbDataReader.GetString(Int32).)
Public method Supported by the XNA Framework GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Supported by the XNA Framework GetValue Gets the value of the specified column in its native format. (Overrides DbDataReader.GetValue(Int32).)
Public method Supported by the XNA Framework GetValues Populates an array of objects with the column values of the current row. (Overrides DbDataReader.GetValues(Object[]).)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method Supported by the XNA Framework IsDBNull Gets a value that indicates whether the column contains non-existent or missing values. (Overrides DbDataReader.IsDBNull(Int32).)
Protected method Supported by the XNA Framework MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public method Supported by the XNA Framework NextResult Advances the DataTableReader to the next result set, if any. (Overrides DbDataReader.NextResult().)
Public method Supported by the XNA Framework Read Advances the DataTableReader to the next record. (Overrides DbDataReader.Read().)
Public method Supported by the XNA Framework ToString Returns a string that represents the current object. (Inherited from Object.)
Top
  Name Description
Explicit interface implemetation Private method Supported by the XNA Framework IDataRecord.GetData For 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, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ