GetStringFromDataRow(DataRowView,String,String) Method
- Last UpdatedNov 06, 2025
- 1 minute read
Convert and return the specified field of the supplied System.Data.DataRowView as a string 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 GetStringFromDataRow( _
ByVal row As DataRowView, _
ByVal columnName As String, _
ByVal defaultValue As String _
) As String
'Usage
Dim row As DataRowView
Dim columnName As String
Dim defaultValue As String
Dim value As String
value = Helper.GetStringFromDataRow(row, columnName, defaultValue)
public static string GetStringFromDataRow(
DataRowView row,
string columnName,
string defaultValue
)
Parameters
- row
- The System.Data.DataRowView 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
A string representation of the specified field value