Solved

Concurrency Violation

Posted on 2009-05-19
1
619 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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

7 Experts available now in Live!

Get 1:1 Help Now