TableAdapter update unchanged record cause Concurrency Violation

I found that concurrency violation would occur if updating the database using table adapter when the actual record does not have any change. Seems like my DataGridView marked the row dirty.

TableAdapter.Update would result in concurrency violation because zero record was modified. Seems like TableAdapter did not verify there are actual changes in the record before sending the update command. Bug



Answer this question

TableAdapter update unchanged record cause Concurrency Violation

  • wckdtribal

    It may be simple to reproduce in your project, but I can't reproduce the problem you describe on my data grid. To my mind, that makes it probable that it's related to your project or data source.

    The scenario I was describing isn't complicated. It just requires that you have a DBNull value in a field. In the data set designer, look at the default values for your fields. If you find one that throws an exception if null, but has a default value of DBNull, if you try to update the data source twice, you will get a concurrency violation the second time. Since what you describe a situation where you get exactly that effect, it seems possible that that's the cause.


  • Tony Maynard-Smith

    I've found that if you do an update on a table adapter with a record that has DBnulls in required fields, the update looks like it works, the underlying data source is updated (albeit with some bad field values), but the record for the row still shows as dirty. The next time you update the table, it tries to update the row again and generates a concurrency violation.

    While maybe not a bug, it's at least rude of the update not to let you know that you have a problem.


  • render77

    The senario you mentioned may be a bit too complicated alreay.

    It's very easy to reproduce the problem, simply modify any field in the data bound DGV and change it back to the original value! Update the table with tableadpater and you will get concurrency violation.

    Users have the right to change their mind, right


  • TableAdapter update unchanged record cause Concurrency Violation