Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 18-May-12 3:32am
v2
Comments
Mohamed Mitwalli 18-May-12 9:36am    
Share your code
Prasad_Kulkarni 18-May-12 9:38am    
Post some code snippet Yatin

1 solution

The error you are getting is the result of modifying the key to the record.
You need to check your code and remove anything that will change the key. For example: if your code does something like this:

C#
OrdersProduct currentProduct = {populate from database};

...

currentProduct = modifiedProduct;


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!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900