本文介绍了Windows Phone 7 SQL Server CE rowversion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Phone 7上的SQL Server CE中更新表时,我遇到了问题.当我调用提交更改时,该应用程序将关闭,没有任何异常或错误. Visual Studio甚至仍在运行.

I had a problem when updating a table in SQL Server CE on Windows Phone 7. When I would call submit changes the app would close without any exceptions or errors. Visual Studio even remained running.

删除rowversion列可解决此问题.我环顾四周,不确定是否遗漏了一些东西,但是使用rowversion列时有什么特别的事情要做吗?

Removing the rowversion column fixed the problem. I've looked around and not sure if I'm missing something but is there anything special one needs to do when using a rowversion column?

这是该列的属性.我试图弄清楚时创建了一个简单的表.它具有3列:

Here are the attributes for the column. I created a simple table when trying to figure this out. It has 3 columns:

  • Id(向导)
  • TestColumn(nvarchar100)
  • MyRowVersion(行版本)
  • Id (Guid)
  • TestColumn (nvarchar100)
  • MyRowVersion (rowversion)

代码:

[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MyRowVersion", AutoSync=AutoSync.Always, DbType="rowversion", CanBeNull=true, IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]

推荐答案

假设您使用SQL Server Compact Toolbox生成了数据上下文,则存在一个错误,如果您的索引与主键覆盖的列相同,则会导致崩溃.尝试使用最新的Toolbox插件(版本2.6.2或更高版本)重新生成DataContext.该问题的解决方法是删除重复"索引.

Assuming you generate the datacontext with the SQL Server Compact Toolbox, there is a bug, if you have indexes that cover same columns as primary keys, that causes the crash. Try to re-gen the DataContext with the latest Toolbox addin (version 2.6.2 or later). Workaround for the issue is to delete the "duplicate" index.

这篇关于Windows Phone 7 SQL Server CE rowversion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-17 16:01