Click to See Complete Forum and Search --> : Store procedure returned null value


jhoanofarch
December 7th, 2004, 02:00 AM
I have problem on stored procedure after executing it

This is the select statement inside the stored procedure:
select sum(amt) as total from orders where order_Date = today

The problem occurs when there is no record or orders on a specific date.
How could I check if the value returned is null or there is no record found in vb.net?

Hope someone could help me on this. Thanks!!!

Krzemo
December 7th, 2004, 08:32 AM
2 solutions:

in SQL (Ms SQL) for example:
SELECT IsNUll((select sum(amt) as total from orders where order_Date = today),0)


in VB use .IsNull (as I remember) method of DataReader or DataTable

ddrib
June 22nd, 2005, 06:47 AM
SQL Server 2000

SELECT COALESCE(sum(amt),0) as total from orders where order_Date = today