Solved

Concurrency Violation

Posted on 2009-05-19
1
623 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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