Hi @Roshan Kumar ,
Welcome to Microsoft Q&A platform and thanks for using Azure Services.
As I understand from the question, Store update, insert, or delete statement affected an unexpected number of rows (0).
The exception means that between time when you fetched data from database and modified it, your data had been changed.
Please refer to Saving Changes and Managing Concurrency for more details.
You can try use refresh method to fix it.
try {
context.SaveChanges();
} catch (OptimisticConcurrencyException) {
context.Refresh(RefreshMode.ClientWins, yourentity);
context.SaveChanges();
}
More discussions link for this issue which might be useful:
solution-for-store-update-insert-or-delete-statement-affected-an-unexpected-n
entity-framework-store-update-insert-or-delete-statement-affected-an-unexpec
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on or upvote button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification