Multiuser database access

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cj

    #1

    Multiuser database access

    The program I just finished allows users to pull a set of records from
    sql server and edit them. It is meant to be a one user system but it
    makes me start thinking. Suppose two users use the program at the same
    time. Both get the same starting set of data. Both users change the
    same records but not the same way and they both save. I assume the last
    one to save is the way the record will end up in sql server. Suppose
    that is not correct. What do we do to ensure the second user gets an
    error that that record has changed since they loaded it? Is there
    record locking etc available in VB? How do programmers deal with this
    these days?
  • Armin Zingler

    #2
    Re: Multiuser database access

    "cj" <cj@nospam.nosp amschrieb
    The program I just finished allows users to pull a set of records
    from sql server and edit them. It is meant to be a one user system
    but it makes me start thinking. Suppose two users use the program
    at the same time. Both get the same starting set of data. Both
    users change the same records but not the same way and they both
    save. I assume the last one to save is the way the record will end
    up in sql server. Suppose that is not correct. What do we do to
    ensure the second user gets an error that that record has changed
    since they loaded it? Is there record locking etc available in VB?
    How do programmers deal with this these days?

    http://msdn2.microsoft.com/en-us/lib...cz(VS.90).aspx



    Armin

    Comment

    • cj

      #3
      Re: Multiuser database access

      Finally an article in MSDN I understand, although I think I'll have to
      try a few things when I get back to the office next week.

      Now this covered optimistic concurrency. Can we do pessimistic
      concurrency in VB? Do you have a link to that?


      Armin Zingler wrote:
      "cj" <cj@nospam.nosp amschrieb
      >The program I just finished allows users to pull a set of records
      >from sql server and edit them. It is meant to be a one user system
      >but it makes me start thinking. Suppose two users use the program
      >at the same time. Both get the same starting set of data. Both
      >users change the same records but not the same way and they both
      >save. I assume the last one to save is the way the record will end
      >up in sql server. Suppose that is not correct. What do we do to
      >ensure the second user gets an error that that record has changed
      >since they loaded it? Is there record locking etc available in VB?
      >How do programmers deal with this these days?
      >
      >
      http://msdn2.microsoft.com/en-us/lib...cz(VS.90).aspx
      >
      >
      >
      Armin

      Comment

      • Armin Zingler

        #4
        Re: Multiuser database access

        "cj" <cj@nospam.nosp amschrieb
        Finally an article in MSDN I understand, although I think I'll have
        to try a few things when I get back to the office next week.
        >
        Now this covered optimistic concurrency. Can we do pessimistic
        concurrency in VB? Do you have a link to that?
        >
        >
        Armin Zingler wrote:
        "cj" <cj@nospam.nosp amschrieb
        The program I just finished allows users to pull a set of
        records from sql server and edit them. It is meant to be a one
        user system but it makes me start thinking. Suppose two users
        use the program at the same time. Both get the same starting
        set of data. Both users change the same records but not the
        same way and they both save. I assume the last one to save is
        the way the record will end up in sql server. Suppose that is
        not correct. What do we do to ensure the second user gets an
        error that that record has changed since they loaded it? Is
        there record locking etc available in VB? How do programmers
        deal with this these days?

        http://msdn2.microsoft.com/en-us/lib...cz(VS.90).aspx

        No, can't provide a link. I'd ask in the ADO.Net group:
        microsoft.publi c.dotnet.framew ork.adonet

        A cross-language question, IMO.


        Armin

        Comment

        • WenYuan Wang [MSFT]

          #5
          Re: Multiuser database access

          Hello cj,

          Pessimistic locking is not natively supported in ADO.NET. However, we can
          achieve this type of locking through transactions. The following article is
          a sample about it.

          [Pessimistic locking solves ADO.NET concurrency problems]

          Hope this helps. If there is anything unclear, feel free to update here
          again. We are glad to assist you.

          Have a great day,

          Best regards,
          Wen Yuan
          Microsoft Online Community Support
          =============== =============== =============== =====
          This posting is provided "AS IS" with no warranties, and confers no rights.

          Comment

          Working...