Concurrency problems

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

John

Hi

I am getting a concurrency error when updating table in a dataset using a
dataadapter. I am the only one using the app so it has to be something else
disguised as a concurrency issue. What steps should I follow to resolve
this?

Thanks

Regards
 
It is a typical dataset/datadpater scenario where
select/insert/update/delete commands are predefined and form controls are
bound to the dataadapter using code. I am using the update method on the
dataadapter to submit the update and that is where I am getting the error.
This application was working initially, I changed a few fields, update the
sql statements and now the app gives error on update.

I hope I have answered the question. Here is the relevant code;

Dim Row As DataRow

Focus()
bmCompanyDetails.EndCurrentEdit() ' bmCompanyDetails is defined as
System.Windows.Forms.CurrencyManager

' Determine Update for Companies
If bmCompanyDetails.Count > 0 Then
Row = CType(bmCompanyDetails.Current, DataRowView).Row
If Row.RowState = DataRowState.Modified Then
daCompanies.Update(ds.tblClients) '<=== This statement
gives the error
end if
end if
 
I suppose you need to check your sql update statement (the WHERE
clause) in daCompanies.. I spent a lot of time trying to insert one
manually but didn't work so in the end I just used the
commandbuilder..
 
I have regenerated the sql statements using command builder and I am still
getting the problem. Any ideas? A while back I had a similar problem and I
set defaults for all my boolean fields to false which fixed it. Could this
be a similar problem?

Thanks

Regards
 
PS: This is the error I am getting;

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)
 
Final bit: I have cleared all the data in the table and now I can add news
records and then edit them without problem. Could it be something to do with
the existing data that I imported from another access table?

Thanks

Regards
 
Back
Top