DbDataReader.GetFieldValue(Int32) DbDataReader.GetFieldValue(Int32) DbDataReader.GetFieldValue(Int32) DbDataReader.GetFieldValue(Int32) Method

Definition

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

public:
generic <typename T>
 virtual T GetFieldValue(int ordinal);
public virtual T GetFieldValue<T> (int ordinal);
abstract member GetFieldValue : int -> 'T
override this.GetFieldValue : int -> 'T
Public Overridable Function GetFieldValue(Of T) (ordinal As Integer) As T

Type Parameters

T

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

Parameters

ordinal
Int32 Int32 Int32 Int32

The column to be retrieved.

Returns

T T T T

The column to be retrieved.

Exceptions

The connection drops or is closed during the data retrieval.

-or-

The SqlDataReader 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-

Tried 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.

T doesn't match the type returned by SQL Server or cannot be cast.

Remarks

For more information, see SqlClient Streaming Support.

Applies to