473,624 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Concurrency violation: the UpdateCommand affected 0 records

Hello,

I got the error "Concurrenc y 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.se lectCommand=New OleDbCommand(my SelectSql, myConn)
Dim updateCB as OleDbCommandBui lder =New OleDbCommandBui lde(myDataAdpte r)
myConn.Open()
myDataAdpter.Up date(UpdatedDat aSet) ' 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 1898

"Miriam" <Mi****@discuss ions.microsoft. comwrote in message
news:07******** *************** ***********@mic rosoft.com...
Hello,

I got the error "Concurrenc y 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.se lectCommand=New OleDbCommand(my SelectSql, myConn)
Dim updateCB as OleDbCommandBui lder =New OleDbCommandBui lde(myDataAdpte r)
myConn.Open()
myDataAdpter.Up date(UpdatedDat aSet) ' 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2289
by: Charlie Williams | last post by:
I am having difficulty performing updates and deletions on an Access database using the Update() method of the OleDBDataAdapter. I can insert rows without a problem, but I get a concurrency exception when trying to update or delete. I am quite sure that no concurrency conflicts actually exist. Is there a reason why the data adapter I am using may have a different row version that the database that it got its data from?
25
2396
by: nick | last post by:
I'm having trouble updating from a datagrid. It's says "Concurrency violation: the UpdateCommand affected 0 records", though I can't see how it's related to "concurrency". I can insert and delete with no problem. Here's the code that's causing the problem: public void UpdateDataSource(Dancers.allbookings ChangedRows) { try { if ((ChangedRows != null))
4
3095
by: Robert Schuldenfrei | last post by:
Dear NG, I was about to "improve" concurrency checking with a Timestamp when I discovered that my current code is not working. After about a day of beating my head against the wall, I am turning to the NG in hopes that someone can spot what I am doing wrong. Key to this technique working is the SQL UPDATE statement. It is designed to fail
0
1035
by: Dzemo | last post by:
i use this code to get data into dataset cmd.CommandType = CommandType.Text cmdUpdate.CommandType = CommandType.Text cmdUpdate.CommandText = "Update BigOne Set Rezultat=? where ID=?" cmdUpdate.Parameters.Add("Rezultat", OleDb.OleDbType.Char, 30, "Rezultat")
1
7181
by: Geraldine Hobley | last post by:
Hello, I have a problem whereby I have a datagrid that is bound to a dataTable. However occassionally when I edit the datagrid I get the following message. Concurrency Violation the update Command affected 0 records. The message appears to be completely random and If I go back out and into the form again it may then work properly.
5
31413
by: Vayse | last post by:
In my save code, most of items save fine. But sometimes I get a concurrency violation message. "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." It happens on the same records each time - once this happens, it never saves ok again. The immediate window also has states: A first chance exception of type 'System.Data.DBConcurrencyException' occurred in System.Data.dll
7
1766
by: William E Voorhees | last post by:
I'm updating an Access database in a windows multi-user environment. I'm using disconnected data I read data from an Access Data table to a data object I update the data object from a windows form I save the data from the data object to the Access Data table using a data adapter as follows:
11
1834
by: John | last post by:
Hi I had a working vs 2003 application with access backend. I added a couple fields in a table in access db and then to allow user to have access to these fields via app I did the following; 1. Regenerated the data adapter sqls by running the data adapter wizard and pasting the resulting code into my app. 2. Deleted the data adapter correspond to the relevant access table from the
0
1104
by: brads745678 | last post by:
Hi, I am having a problem with my VB .NET application. I am trying to do the most simplest of things, and I've even achieved this task before. All I am trying to do is update an access DB from VB .NET 2003 using OleDb. I have dragged a data adapter onto my form and configured it correctly setting the connection to the DB and setting a query for the adapter to just read in all columns from a single table. I have then generated a data set from...
0
8249
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8179
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8348
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2613
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.