Saturday, March 10, 2007

Validate value on DBNull


You need a specific value from a datareader, and it is possible that the value is DBNull.

This way we validate the value on DBNull.

if (!reader.GetValue(6).Equals(System.DBNull.Value))
{
tempr.aantalPlaten
= reader.GetInt32(6);
}

No comments: