Solved

Concurrency Violation

Posted on 2009-05-19
1
621 Views
Last Modified: 2013-11-08
I have a project where I am accept data to  be entered by the user in to a Datagridview.   When the user adds data and clicks save the changes are saved to the database without any issues.  The problem comes in when the user trys to add edit an existing row in the datagrid that has already been saved.  

A concurrency error is returned when trying to add or change an existing row in the datagrid after the first change has been made.   I have be reading articles all over the web about this but can't seem to find a solution.   I read somewhere  that I should not use a command builder (which I am not) and define the insert and update commands myself (which I did).   I am not sure what I need to do to resolve this my i have to find a awnser somewhere and am hoping someone can help me out.

I am using a datatable to populate the datagridview and trying to save the changes to an MSAccess database.    When trying to save the changes I am updating the dataadapter as follows:

 daItems.Update(dtItems)
0
Comment
Question by:Mike_Stevens
1 Comment
 
LVL 5

Accepted Solution

by:
AdGroot earned 500 total points
ID: 24423808
The problem  with a concurrency error is that the update statement can't find the record he wan't  to update.

Check your where clause of the update command  if you use fields what have been changed by some other user.

In that case de update statement will not find a record and throws a exception
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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