Return values from SQL compute commands

  • Thread starter Thread starter John Dann
  • Start date Start date
J

John Dann

I have a vb.net program that runs summary commands on columns of a
data table. So eg I have a couple of lines of code:

MyValue= DataTable.compute(computestring, Nothing)

where eg

computestring="MAX(" & columnname & ")"

Occasionally it happens that the column is full of DBNull.Value
values. In this eventuality MyValue seems to take on an unknown type,
though it doesn't seem to raise any errors when the column datatype is
double.

My question is what type could this null value be. I've tried testing
for DBNull.Value, Not IsNumeric so that I can trap the error, but it's
neither of these. I'm not sure how to test for NaN (If MyValue is
NaN... gives a syntax error).

Any thoughts please?
JGD
 
OK, Solved I think. There must have been some unflagged/overlooked
syntax/logic error in how I was testing for DBNull.Value, which was
indeed the errant return value.
 
John Dann said:
My question is what type could this null value be. I've tried testing
for DBNull.Value, Not IsNumeric so that I can trap the error, but it's
neither of these. I'm not sure how to test for NaN (If MyValue is
NaN... gives a syntax error).

Check the IsNull method instead.
 
Back
Top