Solved

Concurrency violation on SQL delete

Posted on 2009-04-06
3
292 Views
Last Modified: 2012-05-06
Hi Experts,
I compare two datatables A (Notes datasource) and B (SQL datasource) the following way:
1. Loop through all rows in A.
(A) If a row with a similar key can be found in B: update the row in B.
(B) If the row can not be found in B, create a new row B.

2. Loop through all rows in B.
(A) If no row with a similar key can be found in can be found in A: delete the row in B.

3. Update B

Datatable A and B should be exactly the same after 1 and 2.

I get a concurrency violation on the delete command "0 rows of 1 were effected" after the update command. Should I update in between 1 and 2 or use accept changes somewere to prevent this message?

Thanks in advance,
MB

0
Comment
Question by:mark_norge
3 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 250 total points
ID: 24075001
A "Concurrency violation" means there are 2 rows in the DataTable with the same primary key value. Check your step 1-(B).

Wayne
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 24075119
Consider updating after step 1 to isolate the problem. It would confirm whether the problem is in step 1 or 2.
0
 

Author Closing Comment

by:mark_norge
ID: 31566922
Thanks for the help. I used both suggestions and now use Guids and an additional Update.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question