sqlCommand.ExecuteScalar return value 'undefined value'

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

How can that be? Isn't it supposed to return dbnull if there is nothing in
the select?


Ronen
 
Hi RA,

You are getting Nothing (VB) or null(C#) value.
I guess if there is nothing (not even a dbnull field) to return you get null
(DBNull is a returned Null from database)
 
ExecuteScalar returns the value of the first column of the first row of the
first resultset. if there is no resultset, then there is no value to return,
so it returns null. makes perfect sense.

-- bruce (sqlwork.com)
 
Back
Top