Concurrency Issue in Update

  • I need to explain the process here, so bear with me.

    I have a very simple ASP.NET 2.0 C# form that allow the user

    to select an option from the combo box, click on the SAVE button

    that would call a stored procedure to update and save their selected

    option to a table in a database (SS2005). It is a very simple process.

    The problem here is data does not perform a proper update

    when there is (are) other processes update/insert going on to the

    same table. So, the user have to redo this process several times

    a day to have the update sticks to the table.

    The other update/insert processes that I mentioned above

    is running on every hour and all day, so that is something I cannot

    change. So, how can I get this update work when there is another

    update in the same table?

    We did not have this problem before because the other processes

    were only running once a day. So, how do you deal with concurrency

    issue in updating the data in the database?

    Any input or advices would be greatly appreciated

  • You need to catch the DBConcurrencyException in your C# code. In the catch you can present the user with the new data and the data they entered and let them choose what they want to do. You could also force the over write of the new data with the stale data in the catch, but I wouldn't recommend this. There are loads of example on the net about handling DBConcurrencyExceptions so you shouldn't have a problem finding example code.

  • Thanks Brian for responding. DBConcurrencyException is the first time I heard of.

    I'll check it out. I thought it's database update concurrency handle

    in the database, that is why I put it here in this forum. I just found an

    article on Microsoft site for testing concurrency issues, so I am checking

    it out also.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply