views:

1839

answers:

4

When trying to do an update for a Linq object I receive the following error.

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

There is a field in the database that is a Text field because it is going to hold a string that could be as much as 32kb.

Should I change the data type or is there a work around in Linq I could use?

EDIT

I have support SQL 2000 which is why it is a TEXT field.

+1  A: 

Change it to a VARCHAR(max) - it will make life much easier.


EDIT

Full text indexing may help you here, not sure if SQL 2000 would allow you to then "search" on your text column

ck
What about for SQL 2000 whcih I have to support?
David Basarab
What about if I can't change the type of the column? I'm still getting this exception even though UpdateCheck = UpdateCheck.Never for the column in question (type NText). Any other solutions? It only occurs when updating data - if the field was null before the update then the code executes just fine. Thanks. David.
David Conlisk
Full text indexing only allows use of the various fulltext predicates, `CONTAINS`, etc. It is not possible in MSSQL 2k to compare these types of columns with `=`, `!=`, etc.
Donnie
A: 

Change it to a VARCHAR(max) - it will make life much easier.

worked for me also :) Thanks a lot !! U made my day... I wasted my 4-5 hrs on searching and setting the updateCheck property.. but it was not working for me...i dnt know why?.. Please update me if u knw...is it bcoz I am using Dlinq ?

thnks agin :)

if you put a timestamp in your table that will be used for concurrency checks, then updateCheck will be false on all your fields, and updates should be a little quicker
ScottS
+1  A: 

you can always use ToString() on the string in question which will force client side comparison.

Nick Daniels
This is the correct approach....
Ramesh Vel
A: 

I also got that error when I was trying to update a record whit image data type. What should I do now??? :(

Sam