Print Page | Close Window

Error during save

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1713
Printed Date: 21-Sep-2025 at 2:30am


Topic: Error during save
Posted By: amit007
Subject: Error during save
Date Posted: 15-Apr-2010 at 10:36am
Hello,
I am keep on seeing following exception when saving in silverlight.:
"Store update, insert, or delete statement affected an unexpected number of rows(0). Entities may have been modified or deleted since entities were loaded. Referesh ObjectStateManager entries".
 
This error usually happens if I were to save multiple objects. It saves successfully to database, but when checking for error once the Async save has been completed there is an exception. I also noticed this message when I am the only updating records, so i don’t think this would be concurrency issue when though it looks like.   Does anyone know what could be the underlying issue?
 
Thanks,
Amit
 



Replies:
Posted By: davidklitzke
Date Posted: 15-Apr-2010 at 10:55am
Have you tried looking at these links?
 
http://msmvps.com/blogs/kevinmcneish/archive/2009/12/03/understanding-the-entity-framework-concurrencyexception-store-update-insert-or-delete-statement-affected-an-unexpected-number-of-rows.aspx - http://msmvps.com/blogs/kevinmcneish/archive/2009/12/03/understanding-the-entity-framework-concurrencyexception-store-update-insert-or-delete-statement-affected-an-unexpected-number-of-rows.aspx
 
http://naspinski.net/post/Store-update2c-insert2c-or-delete-statement-affected-an-unexpected-number-of-rows-%280%29-Entities-may-have-been-modified-or-deleted-since-entities-were-loaded-Refresh-ObjectStateManager-entries.aspx - http://naspinski.net/post/Store-update2c-insert2c-or-delete-statement-affected-an-unexpected-number-of-rows-(0)-Entities-may-have-been-modified-or-deleted-since-entities-were-loaded-Refresh-ObjectStateManager-entries.aspx
 
 


Posted By: amit007
Date Posted: 15-Apr-2010 at 11:29am
All my updates are done via ideaBlade. I am not explicitly attaching or detaching entities, plus all the fields in EntityManager are set to CuncurrencyMode="None". If  I had any of the fields  CuncurrencyMode set to Fixed then this error would have made sense.


Posted By: davidklitzke
Date Posted: 16-Apr-2010 at 7:18am
See if you can identify any of the entities causing the concurrency violation:
 
Please see the solution in the Concurrency Conflicts folder in the Learning Resources at

     LearningResources\040_BusObjPersistence\ConcurrencyConflicts


Posted By: amit007
Date Posted: 21-Apr-2010 at 8:21am

It turns out that if i call saves twice in program within millisecond, i will see the error. Now I am checking if there is already save in progress, then wait for second save to complete.




Print Page | Close Window