How to pass null value to database field having type of image. I am trying this but getting an error:
if (photo)
cmd.Parameters.AddWithValue("EPhotograph",img);
else
cmd.Parameters.AddWithValue("EPhotograph", "");
if (signn)
cmd.Parameters.AddWithValue("ESignature",sign);
else
cmd.Parameters.AddWithValue("ESignature",DBNull.Value);
Instead of DBNull.Value please try to put empty byte array like this new byte[0];
Reason SQL image type requires byte array as value in them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With