1
Answer

Implicit conversion from data type nvarchar(max) to varbinary(max)

Garima Bansal

Garima Bansal

2y
1.9k
1

I changed the data type of a field in my model from string to byte array and I got this error when I run Update-Database code first migration method.

 

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


        public override void Up()
        {
            AlterColumn("dbo.ApplicantLogins", "Photograph", c => c.Binary(nullable: false));
        }
        
        public override void Down()
        {
            AlterColumn("dbo.ApplicantLogins", "Photograph", c => c.String(nullable: false));
        }

Answers (1)