I got a table with these columns:
- PdfManuals:
- Id (PK, int, not null)
- Name (nvarchar(150), not null)
- ManufacturerId (int, not null)
- ClientId (nvarchar(50), not null)
- LanguageId (int, not null)
- ImageSize (nvarchar(50), not null)
- PdfName (nvarchar(150), not null)
- Image (image, null)
- Pdf (image, null)
And another table: PdfManuals_Manufacturers
- Id (PK, int, not null)
- Name (nvarchar(150), not null)
- ClientId (nvarchar(50), not null)
- LanguageId (int, not null)
And trying to perform this action:
public ActionResult DeleteManufacturer(int id)
{
var manufacturer = _db.PdfManuals_Manufacturers.Where(x => x.Id == id).SingleOrDefault();
var pdfManuals = _db.PdfManuals.Where(x => x.ManufacturerId == id).ToList();
if (manufacturer != null)
{
_db.PdfManuals_Manufacturers.DeleteOnSubmit(manufacturer);
_db.PdfManuals.DeleteAllOnSubmit(pdfManuals);
}
_db.SubmitChanges();
return RedirectToAction("Manufacturers");
}
But i get this error:
The data types image and varbinary(max) are incompatible in the equal to operator.
I am using ASP.NET MVC, and LINQ-To-SQL
I don’t understand why, maybe you guys can help me? 🙂
This is probably caused by LINQ: it checks for the real change of the value (not always possibile as you can see…).
You can avoid this check with the clause UpdateCheck=UpdateCheck.Never:
in the LINQ mapping of the column