I am trying to avoid database null values with 0 and if it is not null then get the original values.
but I am having some issues .
Here is my Sample Code:
int Value = 0;
for(int i = 0; i < tblValue.Rows.Count; i++)
{
if (tblValue.Rows[i][""]== DBNull.Value)//Here it always returns true.. even there are values at Position 1 and
{
Value += 0;
}
else
{
Value += Convert.ToInt32(tblValue.Rows[i][""]);
}
}
Any Idea?
Am I checking DBNUll Value the wrong way?