SqlDataReader.IsDBNullAsync(Int32, CancellationToken) 方法


IsDBNull(Int32) 的非同步版本,該版本會取得值,表示資料行是否包含不存在或遺漏的值。An asynchronous version of IsDBNull(Int32), which gets a value that indicates whether the column contains non-existent or missing values.

取消語彙基元可用於要求在命令逾時之前捨棄作業。The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. 例外狀況將經由傳回的 Task 物件回報。Exceptions will be reported via the returned Task object.

 override System::Threading::Tasks::Task<bool> ^ IsDBNullAsync(int i, System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.Task<bool> IsDBNullAsync (int i, System.Threading.CancellationToken cancellationToken);
override this.IsDBNullAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>



要擷取的以零起始的資料行。The zero-based column to be retrieved.


取消指令,其會傳播說明應該取消作業的通知。The cancellation instruction, which propagates a notification that operations should be canceled. 這並不保證取消。This does not guarantee the cancellation. 如果設定為 CancellationToken.None,就會使這個方法相當於 IsDBNull(Int32)A setting of CancellationToken.None makes this method equivalent to IsDBNull(Int32). 傳回的工作必須標記為已取消。The returned task must be marked as cancelled.


如果指定的資料行值等於 true,則為 DBNull,否則為 falsetrue if the specified column value is equivalent to DBNull otherwise false.


在資料擷取期間,連線中斷或關閉。The connection drops or is closed during the data retrieval.

SqlDataReader在資料擷取期間已關閉。The SqlDataReader is closed during the data retrieval.

沒有可供讀取的資料 (例如,第一個 Read() 沒有被呼叫,或傳回 false)。There is no data ready to be read (for example, the first Read() hasn't been called, or returned false).

嘗試在循序模式下讀取先前讀取的資料行。Trying to read a previously read column in sequential mode.

有進行中的非同步作業。There was an asynchronous operation in progress. 當在循序模式中執行時,此適用於所有 Get* 方法,因為在讀取資料流時可能會呼叫它們。This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

在連接字串中指定了 Context Connection=trueContext Connection=true is specified in the connection string.

嘗試讀取不存在的資料行。Trying to read a column that does not exist.


如需詳細資訊,請參閱SqlClient 串流支援For more information, see SqlClient Streaming Support.