Strange concurrency lesson on Update

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

Earl

Built a stored procedure to do an update on a table with 16 fields. When I
tried to update the database with the table data, I got a concurrency error.
Went through the code, the stored procedure, the command parameters, the
whole deal -- everything looked perfect. So I had the DACW build me the same
stored procedure. Reviewed it line-by-line, comparing. It looked
identical -- except for my decimal values, where I had entered the precision
but not the scale. Could not believe that was causing the error, but lo and
behold -- yes, Virginia, failing to specify the scale of your decimal fields
in the stored procedure will cause a concurrency error. Hope that saves
someone else a few hours.
 
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 concurrency error
when updating the data source. If there is any misunderstanding, please
feel free to let me know.

Based on my experience, the DBConcurrencyException can be caused when no
rows were affected by the update statement. When this exception is thrown,
we can set breakpoints in the SqlDataAdapter.RowUpdating event to check the
update statement running on the server. You can try to run the statement in
some tools to see if there is any rows affected. So failing to specify the
scale of your decimal fields in the stored procedure might cause a
concurrency error.

Please check the following link for more information about
DBConcurrencyException.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemDataDBConcurrencyExceptionClassTopic.asp

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top