{"Operator '=' is not defined for type 'DBNull' and type 'Double'."}

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hmznzr
    New Member
    • Dec 2008
    • 4

    {"Operator '=' is not defined for type 'DBNull' and type 'Double'."}

    when a user inputs a value into a text box, i am searching that value in my dataset. although the number that i entered is in my dataset, i am getting this excemption.
    please help me
  • vinci
    New Member
    • Aug 2006
    • 62

    #2
    Can you post code?

    thanks...

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      I am guessing that your dataset as a column that classifies itself as "double", and also allows Nulls in that column.
      I am not sure how you are searching, but you would need to handle the case when the value in the dataset is null (Nothing)/DBNull

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        A Double cannot be compared to DBNull because the "=" operator has not been implemented to make this comparison. Since you cannot override operators in VB.NET you cannot compare Doubles to DBNull values.

        Make sure the value you are retrieving from your DataSet is not DBNull before comparing the Double to that value If you don't, be prepared to handle the Exception thrown.

        Comment

        Working...