468,791 Members | 1,819 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,791 developers. It's quick & easy.

Concurrency violation: the UpdateCommand affected 0 records

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

Jul 25 '06 #1
1 1716

"Miriam" <Mi****@discussions.microsoft.comwrote in message
news:07**********************************@microsof t.com...
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.
Jul 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Charlie Williams | last post: by
4 posts views Thread by Robert Schuldenfrei | last post: by
5 posts views Thread by Vayse | last post: by
7 posts views Thread by William E Voorhees | last post: by
11 posts views Thread by John | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.