Multi-User Application

Posted on 2004-11-07
Last Modified: 2011-04-14
What're the basic settings & features you need to've in a VB application designed for a multi-user environment.For ex:
a) CursorLocation setting?
b) CursorType setting?
c) LockType setting?
d) Handling "conflicting data"?
e) Any backend-specific differences & considerations?
e) Anything else?
Question by:EXwithRaj
    LVL 11

    Accepted Solution


    If you write such an application you need to make sure that there are no Concurrency conflicts. Depending on how many users are using your application you need to decide which locks you use.

    There are essentially three options for handling these scenarios (with some variations). In the first option, we do nothing, allowing the changes of the last user to overwrite the changes of the first without warning. This is typically known as the "last in wins" scenario.

    The second option is to take the optimistic approach. In this scenario, you predict that it is unlikely or rare that two users will try to edit the same record at the same time; therefore, you place a check in your Update or Delete statement to make sure the underlying record has remained unchanged while the edit has been in progress. If it has changed, the edit fails and the second user will need to start the process over.

    In the third option, you take a pessimistic stand. In this scenario, you predict that it is likely that two users will be vying for the same record so you place a lock on the record when the first person accesses it to prevent any others from accessing it until the first edit is complete. In a connected world, this could be handled by record locking in the database itself. Otherwise, you would need to provide your own system to track locking.

    To achieve this you "just" use the cursors with the appropiate name.

    But this also means you need to keep the connection to the DB "open" all the time. If you have "many" users then this might not be such a good idear.. If you want to close the connection you need to implement your own locking mechanism. For example a field in your DB where you enter the Userid of the user currently editing the record. (i would suggest this)
    LVL 11

    Expert Comment

    edit i mean you "just" use the LOCKING modes...

    Optimistic,Pessimistic and None....

    The cursor only tells your application where the data will be held... If you want to scroll trough a huge table you need to use a server side cursor, since it will only transmit the needed records to your application. (But will cost "extra" performance on your server if you plan to read all rows anyway) If you use a client side cursor then all data will be transfered to your application at once and you will handle the data in your application...

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now