Click here to Skip to main content
13,089,401 members (55,958 online)
Rate this:
Please Sign up or sign in to vote.
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 18-May-12 3:31am
Updated 18-May-12 3:32am
Mohamed Mitwalli 18-May-12 9:36am
Share your code
Prasad_Kulkarni 18-May-12 9:38am
Post some code snippet Yatin

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:

     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!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 18 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100