本文介绍了更新记录中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好frds,

我有2个表1st Order和2nd OrderProduct.两者都具有带有OrderID关系的PK和FK.现在,我想更新某些字段OrderProduct表,但是当我尝试更新该Amout字段和NetAmount字段时,其给定错误.我正在使用linq to asp dotnet中的Sql进行操作.
这是错误:
类型为"OrdersProduct"的对象的成员"ID"的值已更改.


请帮助我.........


预先致谢全部

hello frds,

i have 2 table 1st Order and 2nd OrderProduct. both have PK and FK with OrderID relationship. now i want to update some field OrderProduct table but when i try to update that Amout Field nad NetAmount Field its give error. i m doing that using linq to Sql in asp dotnet.
here is error :
Value of member ''ID'' of an object of type ''OrdersProduct'' changed.


please help me.........


Thank To all in advance

推荐答案

OrdersProduct currentProduct = {populate from database};

...

currentProduct = modifiedProduct;



这很不好-尤其是如果您要让用户访问关键字段并对其进行修改!!!

还请确保您自己不在任何地方修改"ID"字段!



That is bad -- especially if you are letting your user get access to the key field and modifying it!!!

Also make certain you''re not modifying the field ''ID'' anywhere yourself!


这篇关于更新记录中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 02:51