I've got a group of query strings that run as follows:
var nq = db.QueryValue("select COALESCE(COUNT(*),0)from OPPORTUNITY where START_DATE = DATEDIFF(d,0,getdate())");
var nrt = db.QueryValue("select COALESCE(COUNT(*),0)from OPPORTUNITY where START_DATE = DATEDIFF(d,0,getdate()) and OPPORTUNITY_STAGE = '-1'");
var nrep = nrt / nq;
All it gives me is unhandled exeption: cannot divide by zero.
There is often going to be a zero in either or both of the first two query results. How do I get it to display NaN (not a number) instead of crashing?
I'm sure I've asked this before, but I couldn't seem to find what the answer was.
Thanks in advance.
how about adding
IF
condition?