System.Data.Linq.DuplicateKeyException:无法添加具有已在使用的键的实体 [英] System.Data.Linq.DuplicateKeyException: Cannot add an entity with a key that is already in use

查看:68
本文介绍了System.Data.Linq.DuplicateKeyException:无法添加具有已在使用的键的实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的函数用于更新表中的记录并且它正常工作


它突然在几天前生成了以下错误消息


System.Data.Linq.DuplicateKeyException:无法添加具有已使用密钥的实体


我发现只有1条记录存在于带钥匙的桌子。我确信数据库架构没有任何变化。


我不知道因为我的函数只更新数据库中的记录,没有数据插入




解决方案

你好tonylck,


你创建了哪种应用程序?


>> System.Data.Linq.DuplicateKeyException:无法添加具有已在使用的密钥的实体。


像这样的主题:


http://forums.asp.net/t/1199308.aspx


您能否向我们提供在您身边产生此例外的主要代码?


最好的问候,


杰克


My function is used to update record in a table and it is working properly

It generated the following error message few days ago suddenly

System.Data.Linq.DuplicateKeyException: Cannot add an entity with a key that is already in use

I found that only 1 record exists in the table with the key. I am sure that no changes in database schema.

I have no any idea because my function only update record in database, no data insertion

解决方案

Hi tonylck,

Which kind of app did you create?

>>System.Data.Linq.DuplicateKeyException: Cannot add an entity with a key that is already in use.

Like this thread here:

http://forums.asp.net/t/1199308.aspx

Could you provide us the main code which generated this exception in your side?

Best Regards,

Jack


这篇关于System.Data.Linq.DuplicateKeyException:无法添加具有已在使用的键的实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆