locked
<undefined value> RRS feed

  • Question

  • User1628247902 posted
    Greetings, I'm developing database applications using C# on VS.NET 2003 and SQL Server Standard edition (SP3a), and the Microsoft Data Application Blocks. I've run into a situation I'm trying to understand, to wit, if I submit a query using SqlHelper.ExecuteScalar which returns no results, why is the returned item a System.Object of <undefined value>? How do I do error checking 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 P.S. I understand that this is not a specific MDAB issue, but I figure someone here probably knows the answer. :-)
    Monday, October 6, 2003 6:17 PM

All replies

  • User-1907454718 posted
    Does it actually return the string <undefined value>? If you store ExecuteScalar to a string variable is that what you get? i.e. String myresult = SqlHelper.ExecuteScalar(Conn, System.Data.CommandType.Text, "Select count(*) from mytable")
    Tuesday, October 14, 2003 12:31 PM
  • User-1907454718 posted
    Forgot to add the .Tostring() property on the code for the last post.
    Tuesday, October 14, 2003 12:31 PM