GetDoubleFromDataRow(DataRow,String,Nullable<Double>) Method
- Last UpdatedNov 06, 2025
- 1 minute read
Convert and return the specified field of the supplied System.Data.DataRow as a double If the value is a DB Null or the column does not exist or it doesn't convert to the specified type then return the specified default value.
'Declaration
Public Overloads Shared Function GetDoubleFromDataRow( _
ByVal row As DataRow, _
ByVal columnName As String, _
ByVal defaultValue As Nullable(Of Double) _
) As Nullable(Of Double)
'Usage
Dim row As DataRow
Dim columnName As String
Dim defaultValue As Nullable(Of Double)
Dim value As Nullable(Of Double)
value = Helper.GetDoubleFromDataRow(row, columnName, defaultValue)
public static Nullable<double> GetDoubleFromDataRow(
DataRow row,
string columnName,
Nullable<double> defaultValue
)
Parameters
- row
- The System.Data.DataRow from which to extract the specified field or column
- columnName
- The field or column name to retrieve
- defaultValue
- The value to return in the case of a null field value or an error
Return Value
Specified field value as a double