Best practice for concurrency

2 posts, 0 answers
  1. Keith
    Keith avatar
    23 posts
    Member since:
    Nov 2011

    Posted 02 Aug 2019 Link to this post

    I'm implementing a RadGrid control, bound to SQL Server table, and which will be used by up to 12 people at a time. What's the best way to handle concurrency (to be clear, I mean when one person makes a change while others are working or viewing the same records and fields)?

    My client likes the idea of having changes submit to the database on a per cell basis. If a User changes a cell, it gets saved to the DB as soon as the User leaves edit mode of that cell.

    If we go that route, what's a good way to deal with the others who may be VIEWING data that's no longer current?

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3898 posts

    Posted 07 Aug 2019 Link to this post

    Hello, Keith, 

    Updating the database as soon as a cell is updated is a good option. Thus, you will store the changes as soon as possible. The following help article demonstrates several approaches for updating the database: https://docs.telerik.com/devtools/winforms/controls/gridview/populating-with-data/updating-the-database-with-ado.net

    As to the users who are currently viewing the data that might have already been changed, I can suggest two possible solutions. The first one is to fetch the data from the database regularly (e.g. each minute). The more often you perform such an action, the more actual data the users will be seeing. The second one is to have one additional column indicating whether the current record is being edited. This field value should be fetched from the database each second in order to have the correct indication. Thus, the other users will have indication that someone is working with this record. However, this also depends on the refresh time and fetching the data from the database.

    Off topic, note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread. 

    Thank you for your understanding.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top