Hi All,
This blog
http://blogs.msdn.com/b/spike/archive/2010/04/07/concurrency-violation-the-updatecommand-affected-0-of-the-expected-1-records.aspx[
^]
defines the cause of the related problem, however most specifically the cause can be best understand from the msdn
http://msdn.microsoft.com/en-us/library/cs6hb8k4.aspx[
^]
Taken from msdn
Quote:
When an update is attempted, the original version of a changed row is compared against the existing row in the database. If the two are different, the update fails with a concurrency error. It is up to you at that point to reconcile the two rows, using business logic that you create.
An example to illustrate
In below SQL 'modifiedOn' datatime column has been retrived and has been changed to varchar to display it the users
Quote:
select top 1 Name, Role, convert(varchar, modifiedOn, 105) as modifiedOn from TableName
Now when the UI side user updates the row lets say 'Name' and do an row update on the DB, it will fail giving the concurrency violation error, because of the column 'modifiedOn' it is not modified and it is different against the existing row in the database.