Tuesday, May 15, 2012

ASP.NET MVC ERROR: Store update, insert, or delete statement affected an unexpected number of rows (0).

Server Error in '/' Application. 

Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.


Possible Problem:
You placed a ReadOnlyAttribute in you entity key's metadata, which causes its value to become zero

     [DisplayName("Student ID")]
     [ReadOnly(true)]
     public int StudentID { get; set; }


Solution:
Remove the ReadOnlyAttribute

     [DisplayName("Student ID")]
     public int StudentID { get; set; }


For other possible causes for this problem and possible solutions, please refer to this link http://stackoverflow.com/questions/1836173/entity-framework-store-update-insert-or-delete-statement-affected-an-unexpec



  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists
 


Visit Vitabase for Quality Health Supplements