Note that there are some explanatory texts on larger screens.

plurals
  1. POLinqToSQL A member defining the identity of the object cannot be changed
    primarykey
    data
    text
    <p>am trying to update an <code>Item</code> which some of it's members changed so am doing it like this </p> <pre><code>public void Update(IItem pItem) { using(GameDBDataContext db = new GameDBDataContext()) { Item old = db.Items.SingleOrDefault(x =&gt; x.id == pItem.Id); if(old != null) { Item item = pItem as Item; old.id = item.id; old.type = item.type; old.owner_id = item.owner_id; old.player_id = item.player_id; old.currentdura = item.currentdura; old.maxdura = item.maxdura; old.location = item.location; old.socketprogress = item.socketprogress; old.firstsocket = item.firstsocket; old.secondsocket = item.secondsocket; old.effect = item.effect; old.composition = item.composition; old.bless = item.bless; old.isfree = item.isfree; old.enchant = item.enchant; old.suspicious = item.suspicious; old.islocked = item.islocked; old.color = item.color; old.compositionprogress = item.compositionprogress; old.inscribed = item.inscribed; old.inscribetime = item.inscribetime; old.amount = item.amount; db.SubmitChanges(); } } } </code></pre> <p>but every time I try to update the item it throw this exception!</p> <pre><code>System.InvalidOperationException: Value of member 'location' of an object of typ e 'Item' changed. A member defining the identity of the object cannot be changed. Consider adding a new object with new identity and deleting the existing one ins tead. at System.Data.Linq.ChangeProcessor.CheckForInvalidChanges(TrackedObject trac ked) at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) at Database.Managers.ItemManager.Update(IItem pItem) in d:\CProgramming\DarkS iders.Core\Database\Managers\ItemManager.cs:line 59 </code></pre> <p>not sure what is wrong here :-s!?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload