Click here to Skip to main content
15,888,071 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying to Edit record in my database.

My cod is:
Dim drActivate As DataRow
     drActivate = DsLicense.tblLicense.Rows(0)
     drActivate.BeginEdit()
     drActivate("ActivationDate") = Today.Date 'Activation date
     drActivate("Activated") = "Yes" 'Application activated
     drActivate("Key") = UCase(vrFinalKey)
     drActivate.EndEdit()
     taLicense.Update(DsLicense.tblLicense)



It works fine when the third item is not added (vrFinalKey). Error is
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.

Please note there is one record at the time of editing. Also Key field exists there, no issue about it.

Please advise how to fix.
Thanks
Posted

I found the solution somewhere............
need to clear datatable before filling

DsLicense.tblLicense.clear()
me.taLicense.fill(DsLicense.tblLicense)
 
Share this answer
 
Concurrency violation : could it be that the Key field is configured as Unique (no duplicates) and you try to add an existing value ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900