Invalid Use of Null

A

AL

I've been retrieving values using ADO, and setting those
values to a variable MTDSALES (for month to date sales)
which is declared as double.

The problem is that when the retrieved value is Null
I get an error "Invalid Use of Null". Any ideas on how to
handle this situation efficiently?

I could send all retrieved values to a function which
checks for the NUll case and then sends back 0.00 if it is
Null but I'm not sure if this the best way to go about it.

Thanks in advance.
 
J

Jamie Collins

AL said:
I've been retrieving values using ADO, and setting those
values to a variable MTDSALES (for month to date sales)
which is declared as double.

The problem is that when the retrieved value is Null
I get an error "Invalid Use of Null". Any ideas on how to
handle this situation efficiently?

Review whether is it possible to change the database column's
definition to NOT NULL and provide a DEFAULT value e.g. zero. If this
does not fit your business rules i.e. a NULL ('not known') value has
distinct meaning from zero, then rewrite the query using a CASE (or
equivalent syntax) to provide a value in place of a NULL.

Jamie.

--
 
Top