Implicit conversion of the nvarchar data type into varbinary(max) is not allowed. Use the CONVERT function to perform this query

Asked

Viewed 706 times

2

Follows code:

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 one: http://entityframework-plus.net/

Only the problem if I define null in ImageByte2. Follows error:

Implicit conversion of data type nvarchar to varbinary(max) does not is allowed. Use the CONVERT function to execute this query

Now if I set ImageByte1 and ImageByte2 as null, update normally or ImageByte1 and ImageByte2 other than null also makes update.

Some solution?

  • @LINQ, yes, they are voidable

  • He no longer accepts SqlBinary.Null :/

  • @LINQ, problem already solved by updating the latest version 1.7.9

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.