2011-03-27 23 views
2

我得到一個錯誤:的NTEXT和圖像數據類型不能用在何處,HAVING,GROUP BY上或條款

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.

請注意,這是一個更新操作。

我已經安裝了SQLCE的3.5.1.0版本。

下面是錯誤消息和堆棧跟蹤的代碼:

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)

代碼導致錯誤:

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(); 
+0

如果您發佈代碼,XML或數據樣本,**請**在文本編輯器中突出顯示這些行,然後單擊編輯器工具欄上的「代碼示例」按鈕(「{}」),以便對其進行精確格式化和語法突出顯示!如果您發佈錯誤消息,請**使用blockquotes('「')來正確格式化錯誤消息 – 2011-03-27 20:23:17

+0

我忘記了說明和註釋字段存儲RTF字符串,並且我能夠插入數據很好,但只有更新失敗 – Amitesh 2011-03-27 20:25:16

回答