By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,934 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

VB update concurrency exception

P: 1
Hi, I am having a problem with my VB .NET application. I am trying to do the most simplest of things, and I've even achieved this task before.

All I am trying to do is update an access DB from VB .NET 2003 using OleDb. I have dragged a data adapter onto my form and configured it correctly setting the connection to the DB and setting a query for the adapter to just read in all columns from a single table. I have then generated a data set from the data adapter. I have placed a datagrid on my form to hold the data from the dataset.

For the load event on the form I declare the code...

Expand|Select|Wrap|Line Numbers
  1. Me.updateAdapter.Fill(Me.updateDS)
This works fine, and it fills the dataset, which is displayed by the datagrid...

I have then added an update button to the form so that if the datagrid is edited the dataset (& DB) are updated accordingly. The code I use for the click event of the button is...

Expand|Select|Wrap|Line Numbers
  1. Me.updateAdapter.Update(Me.updateDS)
However I am getting a concurrency exception. I cannot believe it wont work as I usually like to hard code everything, but it wont even work using the graphical way.

Can anyone please explain to me how I might solve this, or why it is happening?

Most of the comments I have seen about concurrency exceptions say they are not thrown even to do with issues of actual concurrency...

the exception I catch for it say...

Expand|Select|Wrap|Line Numbers
  1. System.Data.DBConcurrencyException: Concurrency violation: the UpdateCommand affected 0 records.
  2. at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
  3. at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
  4.  
Any help would be much appreciated thanks.
Feb 21 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.