General information
Category:
The Mere Mortals .NET Framework
Kevin,
I added your test code and it still failed. I then moved it to another method without anything else in it, to try and eliminate interaction between other code. I still have the same problem. When I run it the first time, everything is fine. When I run it the second time, I get a "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." exception. Because I'm working on test code, I had an Assert.Fail() at the end of the method, which caused the program to stop. Even after the program stops and starts again, I still get the message on every other run. I think my computer has the Bizare = True flag set.
I thought it might have something to do with running on SQL Express, but it works the same on SQL Server.
Here's the Exception object:
{"Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."}
[System.Data.DBConcurrencyException]: {"Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."
Source: "System.Data"
StackTrace: " at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)\r\n at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)\r\n at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)\r\n at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)\r\n at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)\r\n at OakLeaf.MM.Main.Data.mmDataAccessSql.SaveDataSet(DataSet ds, String tableName, String primaryKeyName, Boolean retrieveAutoIncrementPK, IDbDataAdapter dbAdapter)\r\n at OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey, IDbDataAdapter dbAdapter)"
TargetSite: {Void UpdatedRowStatusErrors(System.Data.Common.RowUpdatedEventArgs, BatchCommandInfo[], Int32)}
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only