Solved

Concurrency violation on SQL delete

Posted on 2009-04-06
3
284 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now