Reputation: 451
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);
Upvotes: 3
Views: 3760
Reputation: 11201
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.
Upvotes: 2