Concurrency issue only affects certain records

  • Thread starter Thread starter Earl
  • Start date Start date
E

Earl

I'm getting a concurrency error when I try to Update certain records in a
single table (SQL2k). Indeed, it appears that a SINGLE record is failing
(although I cannot say that for certain, just all that I've seen -- all
other records I've tried to update do submit the update as advertised). I've
dropped all the indexes and relationships to this table in order to isolate
the error, but still, just the one record fails. When I submit an update, I
submit all fields. For the purposes of troubleshooting, I am updating all
fields to DbNull.value. Any generic thoughts on this?
 
Hi Earl,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you are receiving a
ConcurrencyException when trying to update data to the server. If there is
any misunderstanding, please feel free to let me know.

Based on my experience, the ConcurrencyException is thrown when there is no
row affected during the update. Generally, this might be caused either by a
concurrency issue or incorrect of update statement. When this exception is
generated, we can try to handle the SqlDataAdapter.RowUpdating event for
debugging.

In SqlRowUpdatingEventArgs, the StatementType property indicates the type
of SQL statement is to be executed. The Command property returns the
Command object. We can use Command.CommandText to check what statement is
actually to be executed for updating. We put the statement in Query
Analyzer to see whether it can update any rows in database.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks Kevin. I have restructured my code and eliminated that issue. I added
a timestamp column to the table and used it and the ID for a concurrency
check. This alleviated the problem with the concurrency error.
 
Back
Top