Concurrency violation: the UpdateCommand affected 0 records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I got the error "Concurrency violation: the UpdateCommand affected 0
records" while updating some records in the Windows Application. I am using
VB.net in VS 2003 and the backend is Access (2000) database.
My Code is just like as the following,

Public Function UpdateRecord (UpdatedDataSet as DataSet, myConnstr as
string, mySelectSql as string)
Dim myConn as New oleDbConnection(myConnstr)
Dim myDataAdpter as New OleDbDataAdpter
MyDataAdpter.selectCommand=New OleDbCommand(mySelectSql, myConn)
Dim updateCB as OleDbCommandBuilder =New OleDbCommandBuilde(myDataAdpter)
myConn.Open()
myDataAdpter.Update(UpdatedDataSet) ' Here is the error comes up
myConn.Close()
….
End Function

There are 80% records updated without this problem, only some of them have
this error. Please help.
Thanks in advance.

Miriam
 
Miriam said:
Hello,

I got the error "Concurrency violation: the UpdateCommand affected 0
records" while updating some records in the Windows Application. I am
using
VB.net in VS 2003 and the backend is Access (2000) database.
My Code is just like as the following,

Public Function UpdateRecord (UpdatedDataSet as DataSet, myConnstr as
string, mySelectSql as string)
Dim myConn as New oleDbConnection(myConnstr)
Dim myDataAdpter as New OleDbDataAdpter
MyDataAdpter.selectCommand=New OleDbCommand(mySelectSql, myConn)
Dim updateCB as OleDbCommandBuilder =New OleDbCommandBuilde(myDataAdpter)
myConn.Open()
myDataAdpter.Update(UpdatedDataSet) ' Here is the error comes up
myConn.Close()
..
End Function

There are 80% records updated without this problem, only some of them have
this error. Please help.
Thanks in advance.

Miriam

I've never liked CommandBuilder much. Has been known to give me unexpected
results. Could you try creating your Update command manually and seeing if
the problem goes away?

ChrisM.
 
Back
Top