The Ntext And Image Data Types Cannot Be Used In WHERE, HAVING, GROUP BY, ON, Or IN Clauses

和自甴很熟 提交于 2019-12-12 14:34:06

问题


I am getting an error:

The ntext and image data types cannot be used in WHERE, HAVING, GROUP BY, ON, or IN clauses, except when these data types are used with the LIKE or IS NULL predicates while trying to save the changes to SQLCE tables.

Please note this is an update operation.

I have version 3.5.1.0 of SQLCE installed.

Below is the error message and stack trace with the code:

System.Data.SqlServerCe.SqlCeException was unhandled Message=The ntext and image data types cannot be used in WHERE, HAVING, GROUP BY, ON, or IN clauses, except when these data types are used with the LIKE or IS NULL predicates. Source=SQL Server Compact ADO.NET Data Provider
HResult=-2147217900
NativeError=25923
StackTrace:
at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicUpdate(TrackedObject item)
at System.Data.Linq.ChangeDirector.StandardChangeDirector.Update(TrackedObject item)
at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)

Code causing the error:

var storedBug = DataContext.Bug_Tables.Where(b => b.Id.Equals(bugToSave.Id)).FirstOrDefaul(); 

storedBug.Name = bugToSave.Name;
storedBug.DeveloperId = bugToSave.Developer == null ? null : bugToSave.Developer.Id; 
storedBug.TesterId = bugToSave.Tester == null ? null : bugToSave.Tester.Id; 
storedBug.AssignedPersonId = bugToSave.AssignedPerson == null ? null : bugToSave.AssignedPerson.Id; 
storedBug.BugAreaId = bugToSave.BugArea.Id;
storedBug.BugStatusId = bugToSave.Status.Id;
storedBug.PriorityId = bugToSave.Priority == null ? null : bugToSave.Priority.Id; 
storedBug.Description = bugToSave.Description;
storedBug.Notes = bugToSave.Notes;
storedBug.Replication = bugToSave.Replication;
storedBug.FixedInBuild = bugToSave.FixInBuild;

DataContext.SubmitChanges();

回答1:


Please refer to http://social.msdn.microsoft.com/Forums/en/sqlce/thread/eca752c8-f921-44cf-a35b-5ecb14cc3134 which has all the answers



来源:https://stackoverflow.com/questions/5452083/the-ntext-and-image-data-types-cannot-be-used-in-where-having-group-by-on-or

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!