it really depends on what you need to find out about the result
if you need to test if a the row/data exists then just check for null and
you need to test if the row/data exists and has a valid value then try the
following
///
object result = cmd.ExecuteScalar();
if (result == null)
return "Customer not found";
if (result == System.DBNull.Value)
return "Customer found but name is null";
return (string) result;
///

Signature
Misbah Arefin
https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
http://www.linkedin.com/in/misbaharefin
> Hello All, what is the correct / proper way to check for null values in the
> ExecuteScalar. System.DBNull.Value, Null or both?
MDB - 04 Mar 2008 12:59 GMT
Okay, I am not thinking straight this morning and understand now. Thanks.
> it really depends on what you need to find out about the result
> if you need to test if a the row/data exists then just check for null and
[quoted text clipped - 14 lines]
>> the
>> ExecuteScalar. System.DBNull.Value, Null or both?