Problem with operator

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I have a statement:

if not (emailReader("ByCity") is DBNull.Value) and
emailReader("ByCity") <> "" then

that gives me an error if the value is actually a Null. The error is:

Operator is not valid for type 'DBNull' and string "".

This works fine for all other values including "".

I don't understand what it is complaining about. This is a varChar field.

What is the problem and how do I test this?

The value is going to set a dropdownlist.

Thanks,

Tom
 
tshad,

VB evaluates all expressions in the if statement, even if the first
expression is false. This is why AndAlso and OrElse where added to the
language to give the same short-circuit feature most programmers have
enjoyed for years in other languages.

Hope this helps
Ad.
 
Back
Top