I can check for a DBnull
on a data row using any of the methods.
Either by using
if(dr[0][0]==DBNull.Value)
//do somethin
or by doing
if(dr[0][0].ToString().IsNullOrEmpty())
//do something
In Both Cases I will be getting same result.
But Which one is conecptually right approach. Which was will use less resources
.ToString().IsNullOrEmpty()
? Does a data row have 2 indices,dr[0][0]
? And what ifdr[0][0]
is null, you can't call.ToString()
. It is usually best to provide working code to get better answers. – Patton