title: Updating a single field in ASP.Net MVC 5
body: <p>I want to update a single field in ASP.Net MVC 5 I get error:</p>
  
  <p>My Code:</p>
  
  <pre><code>  MyJobs.PublishStatus = 1;
    db.MyJobContext.Attach(MyJobs);
    db.Entry(MyJobs).Property(x =&gt; x.PublishStatus).IsModified = true;
    //db.Configuration.ValidateOnSaveEnabled = false;
    db.SaveChanges();
  </code></pre>
  
  <p>I get bellow error:</p>
  
  <blockquote>
    <p>Store update, insert, or delete statement affected an unexpected number of rows (0). 
        Entities may have been modified or deleted since entities were loaded. 
        See <a href="http://go.microsoft.com/fwlink/?LinkId=472540" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=472540</a> for information on understanding and
         handling optimistic concurrency exceptions.</p>
  </blockquote>
  
  <p>there is post regarding this error but I could not figure it out:
  <a href="https://stackoverflow.com/questions/1836173/entity-framework-store-update-insert-or-delete-statement-affected-an-unexpec">Entity Framework: &quot;Store update, insert, or delete statement affected an unexpected number of rows (0).&quot;</a> </p>
  
  <p>and updating single field in asp.net MVC from: <a href="https://stackoverflow.com/questions/3642371/how-to-update-only-one-field-using-entity-framework">How to update only one field using Entity Framework?</a></p>