I ran into another problem with Linq and the Orcas beta 1 of Visual Studio.  It seems the code generated for your data classes may not contain a limiter on update checks which can give you the error:

"SQL Server does not handle comparison of NText, Text, Xml, or Image data types"

In my case, the field was a nText data type.  In the designer I can see that it is set to "Update Check" as "Never", but it appears that does not get saved in the code.  To solve the issue, I simply added the setting manually to the generated code on my field "PostText" such as:

[global::System.Data.Linq.Column(Storage="_PostText", Name="PostText", DBType="NText NOT NULL", CanBeNull=false)]

and changed it to:

[global::System.Data.Linq.Column(Storage="_PostText", Name="PostText", DBType="NText NOT NULL", CanBeNull=false, UpdateCheck=System.Data.Linq.UpdateCheck.Never)]

Seems to work fine, with the fix.  Will just have to remember using the Orcas Beta 1 to check whenever I get that error message!

posted on Thursday, June 14, 2007 5:04 PM
Filed Under: Web Dev/ASP.NET/C#   ** All Categories   Databases  

Comments

Gravatar
# re: Ocras beta Linq error!
Posted by Dave
on 7/4/2007 10:16 AM
I found the same thing with the Image type. Your solution worked fine. Unfortunately I was trying to query, change and update a shaped record (e.g. to every field was involved) - omitting the image. When that failed to do anything (including fail with a message) I went with the whole record.

Thanks!
Gravatar
# re: Ocras beta Linq error!
Posted by Thinker
on 7/4/2007 11:45 PM
Yeah, I have been thinking of using timestamping for validation in most tables that I do not think will ever really have a collision which only blows if "any" update has occured since being read which is not going to be the case on many of my tables. It should help in performance also since it only has one comparison to see if the record has changed.
Post a comment










 

Please add 1 and 3 and type the answer here: