DbDataReader.GetFieldValueAsync DbDataReader.GetFieldValueAsync DbDataReader.GetFieldValueAsync DbDataReader.GetFieldValueAsync Method

Definition

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

Overloads

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)

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

Remarks

For more information, see SqlClient Streaming Support.

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

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

public:
generic <typename T>
 System::Threading::Tasks::Task<T> ^ GetFieldValueAsync(int ordinal);
public System.Threading.Tasks.Task<T> GetFieldValueAsync<T> (int ordinal);
member this.GetFieldValueAsync : int -> System.Threading.Tasks.Task<'T>
Public Function GetFieldValueAsync(Of T) (ordinal As Integer) As Task(Of T)

Type Parameters

T

The type of the value to be returned.

Parameters

ordinal
Int32 Int32 Int32 Int32

The type of the value to be returned.

Returns

Task<T>

The type of the value to be returned.

Exceptions

The connection drops or is closed during the data retrieval.

The DbDataReader is closed during the data retrieval.

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

Tried to read a previously-read column in sequential mode.

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.

T doesn’t match the type returned by the data source or cannot be cast.

Remarks

T can be one of the following types:

Boolean Byte Char DateTime
DateTimeOffset Decimal Double Float
Guid Int16 Int32 Int64
String

For more information, see SqlClient Streaming Support.

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

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

public:
generic <typename T>
 virtual System::Threading::Tasks::Task<T> ^ GetFieldValueAsync(int ordinal, System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.Task<T> GetFieldValueAsync<T> (int ordinal, System.Threading.CancellationToken cancellationToken);
abstract member GetFieldValueAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
override this.GetFieldValueAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>

Type Parameters

T

The type of the value to be returned.

Parameters

ordinal
Int32 Int32 Int32 Int32

The type of the value to be returned.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

The cancellation instruction, which propagates a notification that operations should be canceled. This does not guarantee the cancellation. A setting of CancellationToken.None makes this method equivalent to GetFieldValueAsync<T>(Int32). The returned task must be marked as cancelled.

Returns

Task<T>

The type of the value to be returned.

Exceptions

The connection drops or is closed during the data retrieval.

The DbDataReader is closed during the data retrieval.

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

Tried to read a previously-read column in sequential mode.

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.

T doesn’t match the type returned by the data source or cannot be cast.

Remarks

T can be one of the following types:

Boolean Byte Char DateTime
DateTimeOffset Decimal Double Float
Guid Int16 Int32 Int64
String

For more information, see SqlClient Streaming Support.

Applies to