Results 1 to 2 of 2

Thread: Checking for Null

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Angry 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

    Parksie

  2. #2
    Lively Member Tygur's Avatar
    Join Date
    Jul 2002
    Posts
    108
    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".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width