VB update concurrency exception

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brads745678
    New Member
    • Feb 2007
    • 1

    #1

    VB update concurrency exception

    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...

    Code:
    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...

    Code:
    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...

    Code:
    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)
    Any help would be much appreciated thanks.
Working...