CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    449

    ERROR: Operator '=' is not defined for type 'DBNull' ...

    Operator '=' is not defined for type 'DBNull' and string "Option".

    I get this above mentioned error while running the application and the following is the code where I get this error.

    If dr("Option") = "Option1" Then
    ...
    ...
    ...
    End If

    I know this happens when there is no record in the DB and has a value 'NULL". But I don't know how to handle this? Please guide me. Thank you!

  2. #2
    Join Date
    Dec 2005
    Location
    Waterloo ON
    Posts
    545

    Re: ERROR: Operator '=' is not defined for type 'DBNull' ...

    Code:
    If dr("Option") isnot DBNull.Value andalso dr("Option") = "Option1" Then
    .....
    
    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

Featured