I'm querying a SQL DB and sometimes the result is Null, so I thought I would test this but my code results in an error "Data is Null. This method or property cannot be called on Null values."
Here is a snipet of my code:
For i = 5 To 6
cmd = New MySqlCommand(query2t & i, db)
rdr = cmd.ExecuteReader()
rdr.Read()
If Not IsDBNull(rdr.GetUInt32(0)) Then
AfterHour.Series(1).Points.AddXY(Daysofweek(i), FormatNumber(rdr.GetUInt32(0)))
Else
AfterHour.Series(1).Points.AddXY(Daysofweek(i), 0)
End If
rdr.Close()
Next
Can anyone help me with that?
Thanks a lot.