Concurrency error

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am trying to edit and update a record in a single user app and getting
this;

Unhandled Exception: 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)

How can I resolve this? Any help would be appreciated.

Thanks

Regards
 
Hi John,

Whenever I've run into something like this it was because I first added rows
that updated the back end via commandbuilder and sql server was
autoassigning an identity column. The reasons are complex, but it means
that the current dataset doesn't know the value of the identity column and
thus the problem.

Here's what I did: after inserting, I created a new dataset/datatable and
made edit updates to it - had no trouble with this.

HTH,

Bernie Yaeger
 
I have cleared all the existing data in the table and now I can add news
records and then edit them without problem. It must be something to do with
the existing data that I imported from another access table. Does this give
any clues?

Thanks

Regards


Bernie Yaeger said:
Hi John,

Whenever I've run into something like this it was because I first added rows
that updated the back end via commandbuilder and sql server was
autoassigning an identity column. The reasons are complex, but it means
that the current dataset doesn't know the value of the identity column and
thus the problem.

Here's what I did: after inserting, I created a new dataset/datatable and
made edit updates to it - had no trouble with this.

HTH,

Bernie Yaeger

John said:
Hi

I am trying to edit and update a record in a single user app and getting
this;

Unhandled Exception: 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)

How can I resolve this? Any help would be appreciated.

Thanks

Regards
 
I have cleared all the existing data in the table and now I can add news
records and then edit them without problem. It must be something to do with
the existing data that I imported from another access table. Does this give
any clues?

Thanks

Regards
 
Back
Top