Greetings,
I asked this question over on the ADO.NET newsgroup and couldn't scrape
up an answer. I realize that it is more of an ADO question than an SQL
Server question, but I'm hoping there might be an ADO programmer here
that can explain this to me.
I'm developing database applications using C# on VS.NET 2003 and SQL
Server Standard edition (SP3a).
I've run into a situation I'm trying to understand, to wit, if I submit
a query using SqlCommand.ExecuteScalar which returns no results, why is
the returned item a System.Object of <undefined value>?
(Actually, I think I know why -- ExecuteScalar returns a null reference
if there are no results.)
How do I do test for that condition?
I guess I can sort of see why they didn't want to throw an exception --
lot's of queries don't return any results, but on the other hand, I
can't figure out how to test for <undefined value>, either.
Any ideas?
-- Rick