View Ticket
Not logged in
Ticket UUID: d76b409d079fa6b3f957767dd20141e65b816665
Title: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: None Resolution: Unable_To_Reproduce
Last Modified: 2012-02-15 05:59:06
Version Found In:
Hello, My application have a datagridview connect to a dataset through the command: DgvData.DataSource = DataSet.Tables("Table") When the datagridview recall the event CellEndEdit and the DataAdapter update the DataSet through the command :DataAdapter.Update(DataSet.GetChanges, "Table") VB2010 return the error: "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." In my applicatio I use other connector to other db for example FireBird,Postgres,Oracle,SqlServer/access and for all except Sqlite work correctly with the same code.


mistachkin added on 2012-01-25 21:10:40 UTC:
Does your query involve any DATETIME values? What is the schema of the table being updated? Do you have any C# sample code which demonstrates the issue?

Also see ticket [343d392b51].

anonymous added on 2012-01-26 19:57:34 UTC:
No, for all table there is the problem..the database have 600 or more table.. one small table is: CREATE TABLE [TopTabZona] ([IdZona] VARCHAR(6), [Zona] VARCHAR(30), [IdIstat] VARCHAR(6), [IdCatastale] VARCHAR(4), [IdProvincia] VARCHAR(2), [Cap] VARCHAR(5), [IdStato] VARCHAR(4), [Installazione] SMALLINT, PRIMARY KEY([IdZona]));

the example is in VB:

My class is AdoIn

On New AdoIn:

Connection = New SQLite.SQLiteConnection Command = New SQLite.SQLiteCommand DataAdapter = New SQLite.SQLiteDataAdapter CommandBuilder = New SQLite.SQLiteCommandBuilder(DataAdapter)

then i invoke : adoIn.EseguiQuery("Select * FROM Table","Table",CommandType.Text)


Public Sub EseguiQuery(ByVal SQL As String, ByVal TableName As String, ByVal Tipo As Data.CommandType)

Command.CommandType = Tipo Command.CommandText = SQL
Try DataSet.Tables(TableName).Clear() Catch End Try Try Command.ExecuteNonQuery() DataAdapter.SelectCommand = Command DataAdapter.Fill(DataSet, TableName) Catch ex As Exception Err = "Execute Query : " & ex.Message End Try End Sub

then when i click on treeview where there are all tables:

DgvData.DataSource = adoIN.DataSet.Tables("Table")

then on the event "DgvData_CellEndEdit" : adoIN.DataAdapter.Update(adoIN.DataSet.GetChanges,"Table")

ecc..on all other connector this code work good


mistachkin added on 2012-01-30 03:34:21 UTC:
I've attempted to reproduce the issue you describe using more-or-less the sample code you provided; however, I have not been able to. I had to add some code to actually make the it work at all (e.g. using a "Data Source" in the connection string and opening the connection, etc).