Share via


SqlDataReader.GetFieldValue<T>(Int32) Method

Definition

Synchronously gets the value of the specified column as a type. GetFieldValueAsync<T>(Int32, CancellationToken) is the asynchronous version of this method.

public:
generic <typename T>
 override T GetFieldValue(int i);
public override T GetFieldValue<T>(int i);
override this.GetFieldValue : int -> 'T
Public Overrides Function GetFieldValue(Of T) (i As Integer) As T

Type Parameters

T

The type of the value to be returned.

Parameters

i
Int32

The column to be retrieved.

Returns

T

The returned type object.

Exceptions

Trying to read a column that does not exist.

The value of the column was null (IsDBNull(Int32) == true), retrieving a non-SQL type.

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

Remarks

T can be one of the following types:

For more information, see SqlClient Streaming Support.

Applies to