Solved

Concurrency Violation

Posted on 2009-05-19
1
624 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 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