DbDataReader DbDataReader DbDataReader DbDataReader Class

Definition

Reads a forward-only stream of rows from a data source.

public ref class DbDataReader abstract : MarshalByRefObject, IDisposable, System::Collections::IEnumerable, System::Data::IDataReader
public abstract class DbDataReader : MarshalByRefObject, IDisposable, System.Collections.IEnumerable, System.Data.IDataReader
type DbDataReader = class
    inherit MarshalByRefObject
    interface IDataReader
    interface IEnumerable
    interface IDisposable
    interface IDataRecord
Public MustInherit Class DbDataReader
Inherits MarshalByRefObject
Implements IDataReader, IDisposable, IEnumerable
Inheritance
Derived
Implements

Constructors

DbDataReader() DbDataReader() DbDataReader() DbDataReader()

Initializes a new instance of the DbDataReader class.

Properties

Depth Depth Depth Depth

Gets a value indicating the depth of nesting for the current row.

FieldCount FieldCount FieldCount FieldCount

Gets the number of columns in the current row.

HasRows HasRows HasRows HasRows

Gets a value that indicates whether this DbDataReader contains one or more rows.

IsClosed IsClosed IsClosed IsClosed

Gets a value indicating whether the DbDataReader is closed.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets the value of the specified column as an instance of Object.

Item[String] Item[String] Item[String] Item[String]

Gets the value of the specified column as an instance of Object.

RecordsAffected RecordsAffected RecordsAffected RecordsAffected

Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

VisibleFieldCount VisibleFieldCount VisibleFieldCount VisibleFieldCount

Gets the number of fields in the DbDataReader that are not hidden.

Methods

Close() Close() Close() Close()

Closes the DbDataReader object.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

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() Dispose() Dispose() Dispose()

Releases all resources used by the current instance of the DbDataReader class.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the managed resources used by the DbDataReader and optionally releases the unmanaged resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetBoolean(Int32) GetBoolean(Int32) GetBoolean(Int32) GetBoolean(Int32)

Gets the value of the specified column as a Boolean.

GetByte(Int32) GetByte(Int32) GetByte(Int32) GetByte(Int32)

Gets the value of the specified column as a byte.

GetBytes(Int32, Int64, Byte[], Int32, Int32) GetBytes(Int32, Int64, Byte[], Int32, Int32) GetBytes(Int32, Int64, Byte[], Int32, Int32) GetBytes(Int32, Int64, Byte[], Int32, Int32)

Reads a stream of bytes from the specified column, starting at location indicated by dataOffset, into the buffer, starting at the location indicated by bufferOffset.

GetChar(Int32) GetChar(Int32) GetChar(Int32) GetChar(Int32)

Gets the value of the specified column as a single character.

GetChars(Int32, Int64, Char[], Int32, Int32) GetChars(Int32, Int64, Char[], Int32, Int32) GetChars(Int32, Int64, Char[], Int32, Int32) GetChars(Int32, Int64, Char[], Int32, Int32)

Reads a stream of characters from the specified column, starting at location indicated by dataOffset, into the buffer, starting at the location indicated by bufferOffset.

GetData(Int32) GetData(Int32) GetData(Int32) GetData(Int32)

Returns a DbDataReader object for the requested column ordinal.

GetDataTypeName(Int32) GetDataTypeName(Int32) GetDataTypeName(Int32) GetDataTypeName(Int32)

Gets name of the data type of the specified column.

GetDateTime(Int32) GetDateTime(Int32) GetDateTime(Int32) GetDateTime(Int32)

Gets the value of the specified column as a DateTime object.

GetDbDataReader(Int32) GetDbDataReader(Int32) GetDbDataReader(Int32) GetDbDataReader(Int32)

Returns a DbDataReader object for the requested column ordinal that can be overridden with a provider-specific implementation.

GetDecimal(Int32) GetDecimal(Int32) GetDecimal(Int32) GetDecimal(Int32)

Gets the value of the specified column as a Decimal object.

GetDouble(Int32) GetDouble(Int32) GetDouble(Int32) GetDouble(Int32)

Gets the value of the specified column as a double-precision floating point number.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an IEnumerator that can be used to iterate through the rows in the data reader.

GetFieldType(Int32) GetFieldType(Int32) GetFieldType(Int32) GetFieldType(Int32)

Gets the data type of the specified column.

GetFieldValue<T>(Int32) GetFieldValue<T>(Int32) GetFieldValue<T>(Int32) GetFieldValue<T>(Int32)

Synchronously gets the value of the specified column as a type.

GetFieldValueAsync<T>(Int32) GetFieldValueAsync<T>(Int32) GetFieldValueAsync<T>(Int32) GetFieldValueAsync<T>(Int32)

Asynchronously gets the value of the specified column as a type.

GetFieldValueAsync<T>(Int32, CancellationToken) GetFieldValueAsync<T>(Int32, CancellationToken) GetFieldValueAsync<T>(Int32, CancellationToken) GetFieldValueAsync<T>(Int32, CancellationToken)

Asynchronously gets the value of the specified column as a type.

GetFloat(Int32) GetFloat(Int32) GetFloat(Int32) GetFloat(Int32)

Gets the value of the specified column as a single-precision floating point number.

GetGuid(Int32) GetGuid(Int32) GetGuid(Int32) GetGuid(Int32)

Gets the value of the specified column as a globally-unique identifier (GUID).

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetInt16(Int32) GetInt16(Int32) GetInt16(Int32) GetInt16(Int32)

Gets the value of the specified column as a 16-bit signed integer.

GetInt32(Int32) GetInt32(Int32) GetInt32(Int32) GetInt32(Int32)

Gets the value of the specified column as a 32-bit signed integer.

GetInt64(Int32) GetInt64(Int32) GetInt64(Int32) GetInt64(Int32)

Gets the value of the specified column as a 64-bit signed integer.

GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetName(Int32) GetName(Int32) GetName(Int32) GetName(Int32)

Gets the name of the column, given the zero-based column ordinal.

GetOrdinal(String) GetOrdinal(String) GetOrdinal(String) GetOrdinal(String)

Gets the column ordinal given the name of the column.

GetProviderSpecificFieldType(Int32) GetProviderSpecificFieldType(Int32) GetProviderSpecificFieldType(Int32) GetProviderSpecificFieldType(Int32)

Returns the provider-specific field type of the specified column.

GetProviderSpecificValue(Int32) GetProviderSpecificValue(Int32) GetProviderSpecificValue(Int32) GetProviderSpecificValue(Int32)

Gets the value of the specified column as an instance of Object.

GetProviderSpecificValues(Object[]) GetProviderSpecificValues(Object[]) GetProviderSpecificValues(Object[]) GetProviderSpecificValues(Object[])

Gets all provider-specific attribute columns in the collection for the current row.

GetSchemaTable() GetSchemaTable() GetSchemaTable() GetSchemaTable()

Returns a DataTable that describes the column metadata of the DbDataReader.

GetStream(Int32) GetStream(Int32) GetStream(Int32) GetStream(Int32)

Retrieves data as a Stream.

GetString(Int32) GetString(Int32) GetString(Int32) GetString(Int32)

Gets the value of the specified column as an instance of String.

GetTextReader(Int32) GetTextReader(Int32) GetTextReader(Int32) GetTextReader(Int32)

Retrieves data as a TextReader.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValue(Int32) GetValue(Int32) GetValue(Int32) GetValue(Int32)

Gets the value of the specified column as an instance of Object.

GetValues(Object[]) GetValues(Object[]) GetValues(Object[]) GetValues(Object[])

Populates an array of objects with the column values of the current row.

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
IsDBNull(Int32) IsDBNull(Int32) IsDBNull(Int32) IsDBNull(Int32)

Gets a value that indicates whether the column contains nonexistent or missing values.

IsDBNullAsync(Int32) IsDBNullAsync(Int32) IsDBNullAsync(Int32) IsDBNullAsync(Int32)

An asynchronous version of IsDBNull(Int32), which gets a value that indicates whether the column contains non-existent or missing values.

IsDBNullAsync(Int32, CancellationToken) IsDBNullAsync(Int32, CancellationToken) IsDBNullAsync(Int32, CancellationToken) IsDBNullAsync(Int32, CancellationToken)

An asynchronous version of IsDBNull(Int32), which gets a value that indicates whether the column contains non-existent or missing values. Optionally, sends a notification that operations should be cancelled.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
NextResult() NextResult() NextResult() NextResult()

Advances the reader to the next result when reading the results of a batch of statements.

NextResultAsync() NextResultAsync() NextResultAsync() NextResultAsync()

An asynchronous version of NextResult(), which advances the reader to the next result when reading the results of a batch of statements.

Invokes NextResultAsync(CancellationToken) with CancellationToken.None.

NextResultAsync(CancellationToken) NextResultAsync(CancellationToken) NextResultAsync(CancellationToken) NextResultAsync(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.

Read() Read() Read() Read()

Advances the reader to the next record in a result set.

ReadAsync() ReadAsync() ReadAsync() ReadAsync()

An asynchronous version of Read(), which advances the reader to the next record in a result set. This method invokes ReadAsync(CancellationToken) with CancellationToken.None.

ReadAsync(CancellationToken) ReadAsync(CancellationToken) ReadAsync(CancellationToken) ReadAsync(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.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IDataReader.Close() IDataReader.Close() IDataReader.Close() IDataReader.Close()
IDataReader.GetSchemaTable() IDataReader.GetSchemaTable() IDataReader.GetSchemaTable() IDataReader.GetSchemaTable()
IDataRecord.GetData(Int32) IDataRecord.GetData(Int32) IDataRecord.GetData(Int32) IDataRecord.GetData(Int32)

For a description of this member, see GetData(Int32).

Extension Methods

CanGetColumnSchema(DbDataReader) CanGetColumnSchema(DbDataReader) CanGetColumnSchema(DbDataReader) CanGetColumnSchema(DbDataReader)

Gets a value that indicates whether a DbDataReader can get a column schema.

GetColumnSchema(DbDataReader) GetColumnSchema(DbDataReader) GetColumnSchema(DbDataReader) GetColumnSchema(DbDataReader)

Gets the column schema (DbColumn collection) for a DbDataReader.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also