DbDataReader 類別

定義

從資料來源讀取順向的資料流。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
繼承
DbDataReader
衍生
實作

建構函式

DbDataReader()

初始化 DbDataReader 類別的新執行個體。Initializes a new instance of the DbDataReader class.

屬性

Depth

取得值,表示目前資料列的巢狀深度。Gets a value indicating the depth of nesting for the current row.

FieldCount

在衍生類別中覆寫時,取得目前資料列中的資料行數目。When overridden in a derived class, gets the number of columns in the current row.

HasRows

在衍生類別中覆寫時,取得指出這個 DbDataReader 是否包含一或多個資料列的值。When overridden in a derived class, gets a value that indicates whether this DbDataReader contains one or more rows.

IsClosed

在衍生類別中覆寫時,取得指出 DbDataReader 是否已關閉的值。When overridden in a derived class, gets a value indicating whether the DbDataReader is closed.

Item[Int32]

在衍生類別中覆寫時,取得指定資料行的值作為 Object 的執行個體。When overridden in a derived class, gets the value of the specified column as an instance of Object.

Item[String]

在衍生類別中覆寫時,取得指定資料行的值作為 Object 的執行個體。When overridden in a derived class, gets the value of the specified column as an instance of Object.

RecordsAffected

在衍生類別中覆寫時,取得因執行 SQL 陳述式所變更、插入或刪除的資料列數目。When overridden in a derived class, gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

VisibleFieldCount

取得 DbDataReader 中沒有隱藏的欄位數。Gets the number of fields in the DbDataReader that are not hidden.

方法

Close()

關閉 DbDataReader 物件。Closes the DbDataReader object.

CloseAsync()

非同步關閉 DbDataReader 物件。Asynchronously closes the DbDataReader object.

CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(繼承來源 MarshalByRefObject)
Dispose()

釋放 DbDataReader 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the DbDataReader class.

Dispose(Boolean)

釋放 DbDataReader 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the DbDataReader and optionally releases the managed resources.

DisposeAsync()

以非同步方式將 DbDataReader 類別的目前執行個體所使用所有資源釋出。Asynchronously releases all resources used by the current instance of the DbDataReader class.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetBoolean(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為布林值。When overridden in a derived class, gets the value of the specified column as a Boolean.

GetByte(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為位元組。When overridden in a derived class, gets the value of the specified column as a byte.

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

在衍生類別中覆寫時,從起始於指定索引的指定資料行讀取指定的位元組數,並將其寫入至起始於緩衝區中指定位置的緩衝區。When overridden in a derived class, reads a specified number of bytes from the specified column starting at a specified index and writes them to a buffer starting at a specified position in the buffer.

GetChar(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為單一字元。When overridden in a derived class, gets the value of the specified column as a single character.

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

在衍生類別中覆寫時,從起始於指定索引的指定資料行讀取指定的位元組數,並將其寫入至起始於指定位置的的緩衝區。When overridden in a derived class, reads a specified number of characters from a specified column starting at a specified index, and writes them to a buffer starting at a specified position.

GetData(Int32)

傳回所要求資料行的巢狀資料讀取器。Returns a nested data reader for the requested column.

GetDataTypeName(Int32)

在衍生類別中覆寫時,取得指定資料行的資料類型名稱。When overridden in a derived class, gets name of the data type of the specified column.

GetDateTime(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 DateTime 物件。When overridden in a derived class, gets the value of the specified column as a DateTime object.

GetDbDataReader(Int32)

傳回所要求資料行序數的 DbDataReader 物件,可使用提供者特定的實作 (Implementation) 覆寫。Returns a DbDataReader object for the requested column ordinal that can be overridden with a provider-specific implementation.

GetDecimal(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 DecimalWhen overridden in a derived class, gets the value of the specified column as a Decimal.

GetDouble(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為雙精確度浮點數。When overridden in a derived class, gets the value of the specified column as a double-precision floating point number.

GetEnumerator()

在衍生類別中覆寫時,傳回可以用來逐一查看資料讀取器中資料列的列舉程式。When overridden in a derived class, returns an enumerator that can be used to iterate through the rows in the data reader.

GetFieldType(Int32)

在衍生類別中覆寫時,取得指定資料行的資料類型。When overridden in a derived class, gets the data type of the specified column.

GetFieldValue<T>(Int32)

取得所指定資料行值作為要求類型。Gets the value of the specified column as the requested type.

GetFieldValueAsync<T>(Int32)

以非同步方式取得所指定資料行的值作為要求類型。Asynchronously gets the value of the specified column as the requested type.

GetFieldValueAsync<T>(Int32, CancellationToken)

以非同步方式取得所指定資料行的值作為要求類型。Asynchronously gets the value of the specified column as the requested type.

GetFloat(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為單精確度浮點數。When overridden in a derived class, gets the value of the specified column as a single-precision floating point number.

GetGuid(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為通用唯一識別碼 (GUID)。When overridden in a derived class, gets the value of the specified column as a globally unique identifier (GUID).

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetInt16(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 16 位元帶正負號的整數。When overridden in a derived class, gets the value of the specified column as a 16-bit signed integer.

GetInt32(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 32 位元帶正負號的整數。When overridden in a derived class, gets the value of the specified column as a 32-bit signed integer.

GetInt64(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 64 位元帶正負號的整數。When overridden in a derived class, gets the value of the specified column as a 64-bit signed integer.

GetLifetimeService()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
GetName(Int32)

在衍生類別中覆寫時,取得資料行序數從零開始的資料行名稱。When overridden in a derived class, gets the name of the column, given the zero-based column ordinal.

GetOrdinal(String)

在衍生類別中覆寫時,取得具有資料行名稱的資料行序數。When overridden in a derived class, gets the column ordinal given the name of the column.

GetProviderSpecificFieldType(Int32)

取得指定資料行的提供者特定類型。Gets the provider-specific type of the specified column.

GetProviderSpecificValue(Int32)

取得所指定資料行值作為提供者特定類型的執行個體。Gets the value of the specified column as an instance of a provider-specific type.

GetProviderSpecificValues(Object[])

為目前的資料列在集合中取得所有提供者特定的屬性資料行。Gets all provider-specific attribute columns in the collection for the current row.

GetSchemaTable()

傳回 DataTable,以描述 DbDataReader 的資料行中繼資料。Returns a DataTable that describes the column metadata of the DbDataReader.

GetStream(Int32)

取得資料流以從指定的資料行擷取資料。Gets a stream to retrieve data from the specified column.

GetString(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 String 的執行個體。When overridden in a derived class, gets the value of the specified column as an instance of String.

GetTextReader(Int32)

取得文字讀取器以從資料行擷取資料。Gets a text reader to retrieve data from the column.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
GetValue(Int32)

在衍生類別中覆寫時,取得指定資料行的值作為 Object 的執行個體。When overridden in a derived class, gets the value of the specified column as an instance of Object.

GetValues(Object[])

在衍生類別中覆寫時,使用目前資料列的資料行值填入物件陣列。When overridden in a derived class, populates an array of objects with the column values of the current row.

InitializeLifetimeService()

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
IsDBNull(Int32)

在衍生類別中覆寫時,取得指出資料行是否包含不存在或遺漏之值的值。When overridden in a derived class, gets a value that indicates whether the column contains nonexistent or missing values.

IsDBNullAsync(Int32)

以非同步方式取得值,指出資料行是否包含不存在或遺漏的值。Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

IsDBNullAsync(Int32, CancellationToken)

以非同步方式取得值,指出資料行是否包含不存在或遺漏的值。Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(繼承來源 MarshalByRefObject)
NextResult()

在衍生類別中覆寫時,當讀取陳述式批次的結果時,將讀取器向前移到下一個結果。When overridden in a derived class, advances the reader to the next result when reading the results of a batch of statements.

NextResultAsync()

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

NextResultAsync(CancellationToken)

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

Read()

在衍生類別中覆寫時,將讀取器向前移到結果集中的下一筆記錄。When overridden in a derived class, advances the reader to the next record in a result set.

ReadAsync()

以非同步方式將讀取器向前移到結果集中的下一筆記錄。Asynchronously advances the reader to the next record in a result set.

ReadAsync(CancellationToken)

以非同步方式將讀取器向前移到結果集中的下一筆記錄。Asynchronously advances the reader to the next record in a result set.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

IDataReader.Close()

如需這個成員的說明,請參閱 Close()For a description of this member, see Close().

IDataReader.GetSchemaTable()

如需這個成員的說明,請參閱 GetSchemaTable()For a description of this member, see GetSchemaTable().

IDataRecord.GetData(Int32)

如需這個成員的說明,請參閱 GetData(Int32)For a description of this member, see GetData(Int32).

擴充方法

CanGetColumnSchema(DbDataReader)

取得值,指出 DbDataReader 是否可取得資料行結構描述。Gets a value that indicates whether a DbDataReader can get a column schema.

GetColumnSchema(DbDataReader)

取得 DbDataReader 的資料行結構描述 (DbColumn 集合)。Gets the column schema (DbColumn collection) for a DbDataReader.

GetBoolean(DbDataReader, String)

取得指定之資料行的值做為布林值 (Boolean)。Gets the value of the specified column as a Boolean.

GetByte(DbDataReader, String)

取得指定資料行的值做為位元組。Gets the value of the specified column as a byte.

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

從起始於所指定索引的指定資料行讀取所指定位元組數,並將其寫入至起始於緩衝區中指定位置的緩衝區。Reads a specified number of bytes from the specified column starting at a specified index and writes them to a buffer starting at a specified position in the buffer.

GetChar(DbDataReader, String)

取得指定的資料行值做為單一字元。Gets the value of the specified column as a single character.

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

從起始於所指定索引的指定資料行讀取指定的字元數,並將其寫入至起始於指定位置的緩衝區。Reads a specified number of characters from a specified column starting at a specified index, and writes them to a buffer starting at a specified position.

GetData(DbDataReader, String)

傳回所要求資料行的巢狀資料讀取器。Returns a nested data reader for the requested column.

GetDataTypeName(DbDataReader, String)

取得指定資料行的資料類型名稱。Gets name of the data type of the specified column.

GetDateTime(DbDataReader, String)

取得指定之資料行的值做為 DateTime 物件。Gets the value of the specified column as a DateTime object.

GetDecimal(DbDataReader, String)

取得指定的資料行值做為 DecimalGets the value of the specified column as a Decimal.

GetDouble(DbDataReader, String)

取得指定資料行的值做為雙精確度浮點數。Gets the value of the specified column as a double-precision floating point number.

GetFieldType(DbDataReader, String)

取得指定資料行的資料類型。Gets the data type of the specified column.

GetFieldValue<T>(DbDataReader, String)

取得所指定資料行值作為要求類型。Gets the value of the specified column as the requested type.

GetFieldValueAsync<T>(DbDataReader, String, CancellationToken)

以非同步方式取得所指定資料行的值作為要求類型。Asynchronously gets the value of the specified column as the requested type.

GetFloat(DbDataReader, String)

取得指定資料行的值做為單精確度浮點數。Gets the value of the specified column as a single-precision floating point number.

GetGuid(DbDataReader, String)

取得指定資料行的值做為全域唯一識別項 (GUID)。Gets the value of the specified column as a globally unique identifier (GUID).

GetInt16(DbDataReader, String)

取得指定資料行的值做為 16 位元帶正負號的整數。Gets the value of the specified column as a 16-bit signed integer.

GetInt32(DbDataReader, String)

取得指定資料行的值作為 32 位元帶正負號的整數。Gets the value of the specified column as a 32-bit signed integer.

GetInt64(DbDataReader, String)

取得指定資料行的值做為 64 位元帶正負號的整數 (Signed Integer)。Gets the value of the specified column as a 64-bit signed integer.

GetProviderSpecificFieldType(DbDataReader, String)

取得指定資料行的提供者特定類型。Gets the provider-specific type of the specified column.

GetProviderSpecificValue(DbDataReader, String)

取得所指定資料行值作為提供者特定類型的執行個體。Gets the value of the specified column as an instance of a provider-specific type.

GetStream(DbDataReader, String)

取得資料流以從指定的資料行擷取資料。Gets a stream to retrieve data from the specified column.

GetString(DbDataReader, String)

取得指定之資料行的值做為 String 的執行個體。Gets the value of the specified column as an instance of String.

GetTextReader(DbDataReader, String)

取得文字讀取器以從資料行擷取資料。Gets a text reader to retrieve data from the column.

GetValue(DbDataReader, String)

取得指定之資料行的值做為 Object 的執行個體。Gets the value of the specified column as an instance of Object.

IsDBNull(DbDataReader, String)

取得值,這個值表示資料行是否包含不存在或遺漏的值。Gets a value that indicates whether the column contains nonexistent or missing values.

IsDBNullAsync(DbDataReader, String, CancellationToken)

以非同步方式取得值,指出資料行是否包含不存在或遺漏的值。Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱