Some tables I am dealing with have null values and are throwing errors. So far ive tried a few solutions to deal with the nulls with no success.
Here are the code samples from my efforts so far;
If (r("datemodified").Equals(DBNull.Value)) Then
datemodified = String.Empty
Else
datemodified = (r("datemodified"))
End If
and;
If r.HasRows Then
datemodified = (r("datemodified"))
Else
datemodified = String.Empty
End If
and;
If r("datemodified") = Nothing Then
datemodified = String.Empty
Else
datemodified = (r("datemodified"))
End If
and;
If r.IsDBNull("datemodified") Then
datemodified = String.Empty
Else
datemodified = (r("datemodified"))
and via sql;
Select isnull(datemodified, '')
The end result is an IndexOutOfRangeException.
here is the sql;
select datemodified, maintainedby, email, hitcount from grouping where id = @footid
ps, i have ran the query and it is working ok (i.e all the cols exist)