System.NotSupportedException: SQL Server does not handle comparison of NText, Text, Xml, or Image data types.
While updating
in SQL server via LINQ to SQL sometimes you get the exception: “System.NotSupportedException:
SQL Server does not handle comparison of NText, Text, Xml, or Image data types”
To fix
this exception let’s see the possible solutions:
Solution 1:
If you
are getting this exception with NText, Text, or Image data type fields, the
reason is that NText, Text and Image types are deprecated and these fields must
be replaced with the NVARCHAR(MAX), VARCHAR(MAX) and VARBINARY(MAX) types
respectively. These types support string operators, including equality
comparison. And you should be fine then.
Solution 2:
If you
are getting this exception with XML field of your table, then reason is XML field
can never be compared as a string. In order to fix this issue open the dbml
file with xml editor and set the “updatecheck”
to “Never” as follows:
<column canbenull="true" dbtype="Xml" name="PermissionsXml"
type="System.Xml.Linq.XElement" updatecheck="Never"></column>
|
Hope
that helps J
Comments
Post a Comment