LINQ to SQL 异常:SQL Server does not handle comparison of NText, Text, Xml, or Image data types

如果你使用LINQ to SQL过程中遇到异常:SQL Server does not handle comparison of NText, Text, Xml, or Image data types,可能你的数据库表字段中使用了NText,Text,Xml或者Image类型,你需要为dbml自动生成类的相应属性的Attribute添加上UpdateCheck=Never。

需要注意xml在dbml对于的类型为XElement,XElement是引用类型,如果需要对该字段进行更新,不能直接修改,需要重新创建一个XElement,否则所做的修改无法更新到数据库。

 

参考链接:Linq to SQL throws an exception when a column is of type ntext

posted on 2010-11-30 22:59  齐世昌  阅读(516)  评论(0编辑  收藏  举报