Compartir a través de


DbExtensions.GetValueOrDefault Método

Definición

Sobrecargas

GetValueOrDefault<TValue>(IDataRecord, Int32, TValue)

Devuelve un valor si no DBNulles , default(TValue) de lo contrario.

GetValueOrDefault<TValue>(IDataRecord, String, TValue)

Devuelve un valor si no DBNulles , default(TValue) de lo contrario.

GetValueOrDefault<TValue>(IDataRecord, Int32, TValue)

Devuelve un valor si no DBNulles , default(TValue) de lo contrario.

public static TValue GetValueOrDefault<TValue> (this System.Data.IDataRecord record, int ordinal, TValue default = default);
static member GetValueOrDefault : System.Data.IDataRecord * int * 'Value -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TValue) (record As IDataRecord, ordinal As Integer, Optional default As TValue = Nothing) As TValue

Parámetros de tipo

TValue

Tipo del valor que se va a solicitar.

Parámetros

record
IDataRecord

Registro del que se va a recuperar el valor.

ordinal
Int32

Ordinal del fieldname.

default
TValue

Valor predeterminado si el valor en posición es DBNull.

Devoluciones

TValue

El valor especificado o el valor predeterminado para el tipo solicitado.

Excepciones

Se aplica a

GetValueOrDefault<TValue>(IDataRecord, String, TValue)

Devuelve un valor si no DBNulles , default(TValue) de lo contrario.

public static TValue GetValueOrDefault<TValue> (this System.Data.IDataRecord record, string fieldName, TValue default = default);
static member GetValueOrDefault : System.Data.IDataRecord * string * 'Value -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TValue) (record As IDataRecord, fieldName As String, Optional default As TValue = Nothing) As TValue

Parámetros de tipo

TValue

Tipo del valor que se va a solicitar.

Parámetros

record
IDataRecord

Registro del que se va a recuperar el valor.

fieldName
String

Nombre del campo que se va a recuperar.

default
TValue

Valor predeterminado si el valor en posición es DBNull.

Devoluciones

TValue

El valor especificado o el valor predeterminado para el tipo solicitado.

Excepciones

Comentarios

Esta función produce si el elemento especificado no existe.

Se aplica a