Subject Re: Expecting "" value back, receiving System.DBNULL
Author Adam
--- In firebird-support@yahoogroups.com, "David Wessell" <dave@...> wrote:
>
> Hi,
>
> I'm writing a SELECT query, and sometimes the results of one of the
> fields that is queried is empty.. I was expecting a empty string value
> to be returned (Writing in Visual Basic, using ODBC BTW)..
>
> However, the result returned when that field is empty is
> System.DBNULL.. Can someone point me in the direction as to why I
> would receive this?

<null> and '' are not the same thing. You will get into lots of
confusion if you believe they are.

* <null> means that you DO NOT know if there even is a value, it may
exist, may be empty, or may not exist.
* '' means that you DO know it has a value of empty string.

The logic:
'' = <null> evaluates to <null>

If I asked you whether some mystery field was equal to '', you could
not tell me one way or the other. When you test it in a where clause,
it only returns the records which are evaluated to true (not null or
false).

http://www.firebirdsql.org/manual/nullguide.html

Adam