Handling DBNull exception in VB.net
I'm trying to handle `DBNull` exception while reading data from database.
It's my code:

    ...
    Dim SQLRDAs SqlDataReader
    ...
    val1= GetStringFromDB(Trim(SQLRD("Name")))
    val2= GetStringFromDB(Trim(SQLRD("Level")))
    val2= GetStringFromDB(Trim(SQLRD("blahblah")))
    ...
    Public Function GetStringFromDB(ByVal inputValue) As String
         Dim outputValue As String
    
         If Not IsDBNull(inputValue) Then
             outputValue = "null"
         Else
             outputValue = inputValue
         End If
    
         Return outputValue
    End Function
But still I get `Conversion from type 'DBNull' to type 'String' is not valid.` error. What's wrong?
Handling DBNull exception in VB.net
===

I'm trying to handle `DBNull` exception while reading data from database.
It's my code:

    ...
    Dim SQLRDAs SqlDataReader
    ...
    val1= GetStringFromDB(Trim(SQLRD("Name")))
    val2= GetStringFromDB(Trim(SQLRD("Level")))
    val2= GetStringFromDB(Trim(SQLRD("blahblah")))
    ...
    Public Function GetStringFromDB(ByVal inputValue) As String
         Dim outputValue As String
    
         If Not IsDBNull(inputValue) Then
             outputValue = "null"
         Else
             outputValue = inputValue
         End If
    
         Return outputValue
    End Function
But still I get `Conversion from type 'DBNull' to type 'String' is not valid.` error. What's wrong?