Follow the code below:
byte[] image1 = ConvertTo.Bytes(Request.Files[0]);
byte[] image2 = null;
ctx
.Users
.Where(x => x.Id == 1)
.Update(x => new User()
{
ImageByte1 = image1,
ImageByte2 = image2
});
I use this here: link
Only the problem if I set null
to ImageByte2
. Here is an error:
The implicit conversion of the nvarchar data type into varbinary (max) does not is allowed. Use the CONVERT function to execute this query
Now your self set ImageByte1
and ImageByte2
as null
, does update normally or ImageByte1
and ImageByte2
other than null
also does update.
Any solution?