Upraviť

Zdieľať cez


DbDataReader.IsDBNullAsync Method

Definition

Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

Overloads

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.

IsDBNullAsync(Int32)

Source:
DbDataReader.cs
Source:
DbDataReader.cs
Source:
DbDataReader.cs

Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

public:
 System::Threading::Tasks::Task<bool> ^ IsDBNullAsync(int ordinal);
public System.Threading.Tasks.Task<bool> IsDBNullAsync (int ordinal);
member this.IsDBNullAsync : int -> System.Threading.Tasks.Task<bool>
Public Function IsDBNullAsync (ordinal As Integer) As Task(Of Boolean)

Parameters

ordinal
Int32

The zero-based column to be retrieved.

Returns

A Task<TResult> whose Result property is true if the specified column value is equivalent to DBNull or false if it is not.

Exceptions

The connection was dropped or closed during the data retrieval.

-or-

The data reader is closed during the data retrieval.

-or-

There is no data ready to be read (for example, the first Read() hasn't been called, or returned false).

-or-

Trying to read a previously read column in sequential mode.

-or-

There was an asynchronous operation in progress. This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

The column index is out of range.

Remarks

This asynchronous method is only needed to avoid blocking the calling thread when the reader is created in sequential mode.

If sequential mode isn't specified, all column values should become available in memory each time ReadAsync completes, and calling the synchronous version of the method shouldn't block the calling thread.

The default implementation of this asynchronous method invokes its synchronous counterpart and returns a completed Task, potentially blocking the calling thread.

Data providers that support asynchronous programming should override the default implementation using asynchronous I/O operations.

Other methods and properties of the DbDataReader object should not be invoked while the returned Task is not yet completed.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by IsDBNull(Int32).

Applies to

IsDBNullAsync(Int32, CancellationToken)

Source:
DbDataReader.cs
Source:
DbDataReader.cs
Source:
DbDataReader.cs

Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

public:
 virtual System::Threading::Tasks::Task<bool> ^ IsDBNullAsync(int ordinal, System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.Task<bool> IsDBNullAsync (int ordinal, System.Threading.CancellationToken cancellationToken);
abstract member IsDBNullAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.IsDBNullAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Overridable Function IsDBNullAsync (ordinal As Integer, cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

ordinal
Int32

The zero-based column to be retrieved.

cancellationToken
CancellationToken

A token to cancel the asynchronous operation.

Returns

A Task<TResult> whose Result property is true if the specified column value is equivalent to DBNull or false if it is not.

Exceptions

The connection was dropped or closed during the data retrieval.

-or-

The data reader is closed during the data retrieval.

-or-

There is no data ready to be read (for example, the first Read() hasn't been called, or returned false).

-or-

Trying to read a previously read column in sequential mode.

-or-

There was an asynchronous operation in progress. This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

The column index is out of range.

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This asynchronous method is only needed to avoid blocking the calling thread when the reader is created in sequential mode.

If sequential mode isn't specified, all column values should become available in memory each time ReadAsync completes, and calling the synchronous version of the method shouldn't block the calling thread.

The default implementation of this asynchronous method invokes its synchronous counterpart and returns a completed Task, potentially blocking the calling thread. The default implementation also returns a cancelled task if passed an already cancelled cancellation token.

Data providers that support asynchronous programming should override the default implementation using asynchronous I/O operations.

This method accepts a cancellation token that can be used to request the operation to be cancelled early. Implementations may ignore this request.

Other methods and properties of the DbDataReader object should not be invoked while the returned Task is not yet completed. This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by IsDBNull(Int32).

Applies to