Testing for nulls

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

I test for nulls with the following...

DataSetAnalyticalReportCountsAndSums1.tblTowers(0).IsAvgSupplyTotalHardnessNull


But how do I test for nulls on myRow("AvgSupplyTotalHardness") in the code
below?

For Each myRow In
DataSetAnalyticalReportCountsAndSums1.tblTowers.Rows
'Sum the averages of each tower

dblValue = dblValue + myRow("AvgSupplyTotalHardness")

Next


I don't think isDBNull fnction works if the DB value is NULL


Thanks
 
IsDBNULL works for testing for values that are equivalent to DBNull.Value.
So it should work in your case.
 
Have you checked the DataTable.Compute Method. It is so much easier to Sum
the column values. Secondly checkout DBNull.Value to check for Null values
in Columns (something like If not Table1.ColumnName is DBNull.Value Then
....)

HTH

Trevor Benedict R
MCSD
 
Back
Top