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...
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...
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...
Any help would be much appreciated thanks.
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...
VB.NET:
Me.updateAdapter.Fill(Me.updateDS)
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...
VB.NET:
Me.updateAdapter.Update(Me.updateDS)
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...
VB.NET:
System.Data.DBConcurrencyException: Concurrency violation: the UpdateCommand affected 0 records.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)