Return to Snippet

Revision: 29941
at August 5, 2010 07:11 by psybuck2002us


Initial Code
Public Shared Function IsNullToString(ByVal _PossibleNullObject As Object, Optional ByVal _IfNullReturnString As String = "") As String
            If Not IsDBNull(_PossibleNullObject) Then
                Return _PossibleNullObject.ToString
            Else
                Return _IfNullReturnString
            End If
End Function

Initial URL

                                

Initial Description
This code converts database NULL field values to a string. The first argument represents the field from the database (maybe a Datarow field) and the second argument is the optional string that should be returned if a NULL value is encountered. By default, the function returns an empty string value.

Initial Title
Convert database NULL value fields to any string

Initial Tags

                                

Initial Language
VB.NET