Hello anyone know how to fix this error?
The data types ntext and nvarchar are incompatible in the equal to operator.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: The data types ntext and nvarchar are incompatible in the equal to operator.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
An nText field can not be used in optimisitic updates. Your update statement that was generated looks something like:
UPDATE SomeTable
SET {Stuff}
WHERE nTextField=old_nTextField
And old_nTextField is defined as a nvarchar. You can't really define it as nText as nText is just a very long nvarchar field, and even if you COULD get it defined as a nText, it would still be invalid, because you can't use nText= anything, even another nText in a WHERE clause.
|||What should it be? I am now using a text , but it still does not work.|||TEXT/NTEXT/IMAGE data in SQL Server are considered as BLOB (Binary Large Object) data and can not be used with "=" or in sorting. You may need "Text and Image Functions" to manipulate these kinds of data:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_fa-fz_0gs3.asp
Or you can convert the TEXT data (less than 8000 chars) into VARCHAR data to use it in comparation, for example:
select * from test_txt where convert(varchar(8000),t)='The index position of the value parameter if that string is found, or -1 if it is not. If value is Empty, the return value is 0.'
Or use LIKE operator:
select * from test_txt where t like 'The index position of the value parameter if that string is found, or -1 if it is not. If value is Empty, the return value is 0.'
No comments:
Post a Comment