User-719153870 posted
Hi yguyon,
I have the following line of code that is giving me an error is I have a DBNull value. How will how go about in resolving this?
This error is usually caused by a field value is DBNull and it can't be converted to byte[].
To solve this problem, please check DBNull. Value Field and refer to below code:
if (!DBNull.Value.Equals(reader.GetValue(ordinals.GetOrdinal("xxxSignature"))))
{
byte[] pictureAsByteArray = (byte[])reader.GetValue(ordinals.GetOrdinal("xxxSignature"));
}
else
{
byte[] pictureAsByteArray = new byte[0];
}
}
Best Regard,
Yang Shen