Dealing with NULL values
Hi - back again :D
I'm having a problem dealing with NULL values
All I want to do is use a value to populate the text of a label object, as in:
lblText.text = dr("Field1")
(where dr = a datareader)
However if the value was NULL I got the following:
"Cast from type 'DBNull' to type 'String' is not valid. "
So I put the following in to check for NULLs
IfNot dr.Item("Field1").Value Is DBNull.Value Then
lblText.text = dr("Field1")
End if
This is fine if it IS null, but if there actually is value I now get:
"Public member 'Value' on type 'String' not found"
I have no idea what this means or how to deal with it. Any advice???
|