Concurrency violation: the UpdateCommand affected 0 records

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
 
C

ChrisM

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top