Datasets in a network environment. RRS feed

  • Question

  • Again, my last resort.

    Hi everyone, I'm developing an enrollment system now and I'm using MySQL as my database, and using ADO.NET datasets to do stuff with it. This system will be used in a network, so I was wondering. If datasets make a local copy of the database in the computer, how will it affect the transactions when multiple users access it?


    User A and B are both connected to the database, both wants to add a new student, the primary key is studentID, max student ID currently is say, 5 before both users connect. User A updated the database and added a 6th student. Then User B added the 6th student on his dataset which is copied before any change by User A is done with the database. What happens if User B finally updates? Sorry if it's confusing.


    Thanks again.


    Sorry, I found an ebook on visual basic 2010, read a chapter about this, sorry. I'll share it anyway. So, it seems that using the disconnected method for this task is not applicable since users won't see the changes other users make. A connected method will work better because any change will automatically be seen by other users, preventing redundancy or any mistakes.

    • Edited by Leenej Wednesday, January 18, 2012 5:08 PM
    • Moved by Annabella Luo Friday, January 20, 2012 7:22 AM (From:Windows Presentation Foundation (WPF))
    Wednesday, January 18, 2012 4:46 PM

All replies

  • Hi Leenej,

    Thank you for your post.

    According to your description, I think your issue is about data, so I'll move your thread to ADO.NET DataSet forum:

    Thank you for your understanding.

    Have a nice day.

    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 20, 2012 7:22 AM
  • hi,

    when a user initially fetches a dataset from the database, it get a set of records, that have status 'unchanged'.

    Once the user changes data (add, delete, update) in the dataset, the original records are kept inside, and a second set with the changed data is created.

    When the dataset is brought back to the database for update, a dataadapter can choose to first compare the current situation on the database with the original records in the dataset ('use Optimistic Concurrency'). If there is a difference, it is perceived as 'concurrency' and raises an error.

    Regards, Nico
    Friday, January 20, 2012 7:55 AM
  • You must implement a plan for concurrency.  There is a lot of information on this topic, so I'd start in the MSDN library then move to the forums to answer specific questions after you have a better understanding of things.  Basically you have several options, each have their own merits and protocol which you need to decide the best one to use:

    1.  "Last one in wins".  This is just as it says: whoever the last one is to submit data back into the database is the final version.  If user A will have their changes overwritten by user B.

    2.  Other greater levels of concurrency will require some form of unique identifyer, typically this is a datetime/timestamp field that you'd use to check against and determine versions.  Also, this will require some form of additional programming, business rules, and architecture that will allow the user to do what is needed.

    James Crandall ~ Spatial Database Solutions
    Friday, January 20, 2012 2:21 PM