-
Checking for Null
The following code :
If Not objROw2(0).Item("ClientLocality") Is Nothing Then
Me.lblLocality.Text = objROw2(0).Item("ClientLocality")
End If
Causes the following error when it contains nothing:
Additional information: Cast from type 'DBNull' to type 'String' is not valid.
Whats happening??
Thanks in Advance
:confused:
-
Try it this way instead:
If Not objROw2(0).Item("ClientLocality") Is DBNull.Value Then
Me.lblLocality.Text = objROw2(0).Item("ClientLocality")
End If
Basically, just change "Nothing" to "DBNull.Value".