Results 1 to 3 of 3

Thread: null error[RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    null error[RESOLVED]

    I'm getting this error when I try to populate my page. The field can be null in the database, so how do I get around this?

    Cast from type 'DBNull' to type 'String' is not valid.
    Last edited by EyeTalion; Jan 2nd, 2003 at 02:03 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    this is how you can handle null values :

    VB Code:
    1. Dim MyNull As System.DBNull
    2.  
    3. If mystring Is MyNull Then
    4. 'do things
    5. End If

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    thanks...I used:

    Code:
    If objDataReader("display_start_date") Is DBNull.Value Then
                            txtIntDisStartDate.Text = String.Empty
                        Else
                            txtIntDisStartDate.Text = ("display_start_date")
                        End If

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