473,287 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

concurrency violation when perform ds.update twice?

nev
251 100+
I place values in my datatable programatically. then i do...

bs.endedit()
adp.update(ds.dtt)

after that

i perform a find to that record to add some more values

bs.position = bs.find("col", key)
'code to add values to that row
bs.endedit()
adp.update(ds.dtt) '<---- Concurrency violation

please teach me how to do this correctly. take note that i am unable to add those values all at once due to certain requirements. that's why i need to enter partial data first then find that record to add the other values.
Nov 21 '07 #1
3 991
Shashi Sadasivan
1,435 Expert 1GB
hi nev,
i had come across this issue a few months ago, and the amount of code behind my form was humungus.
Anyways....
what was ahppening is that i updated the table. But then at some other point, due to some other functionality, it was updating the same row in the database without using the same dataset used initially.
So which meant that when i ran my update, it had old values.
and threw a concurrency exception

Its something like if you retrieve a dataset, but then before updating it, if someone else changes that row, then the dataset cannot validate the row against the database, and it finds that a concurrency has occoured.

it sounds a bit spagetti, but what you need to do is to re-fill the dataset before changing it the second time.
Nov 21 '07 #2
nev
251 100+
yep! that's what i accidentally did :-)
Nov 22 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
Glad I hit the nail there :)
Nov 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Billy Jacobs | last post by:
I have a client who is getting a concurrency violation error whenever she tries to update a record. I can log in to the site as her simultaneously and update the record with no problem. I can...
4
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...
3
by: Suzanne | last post by:
Hi All I'm having problems getting my data adapter to throw a concurrency exception with an INSERT command. I want to throw a concurrency exception if an attempt is made to enter a row into...
25
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...
2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
2
by: Vladimir Oľura | last post by:
I am building a pocket pc application that requires a datagrid. I am inserting a new row this way: private void mInsert_Click(object sender, System.EventArgs e) { try { DataRow dr =...
2
by: Agnes | last post by:
I got a simple form and using databinding manager to do the add new Now , my big trobule is . I can update the 'addnew' record, However, after I new the record, and then amend it , it got...
5
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...
7
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.