Lock record

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

    #1

    Lock record

    Hi,


    I'm writing a windows application where users can update records but
    how can I lock a record when a user opens it.

    With ado and vb6 you can lock the opened record but with ado.net I
    don't know how to do this.

    I am using vb.net and SQL Server.


    thx.

  • Robert Dufour

    #2
    Re: Lock record

    I agree, I've seen cases where a record was locked when it was opened. The
    person going out to lunch, leaving it locked and others who needed access to
    it being unable to get it until he/she came back and released the lock.
    Not a good idea unless you realy think through and handle all the
    unexpected problem scenarios, which is a lot of work.

    Regards,
    Bob
    "Kerry Moorman" <KerryMoorman@d iscussions.micr osoft.comwrote in message
    news:EC368B1F-99E1-40D3-B557-632EBDC876CC@mi crosoft.com...
    HDI,
    >
    The disconnected architecture of ado.net encourages optimistic locking to
    deal with concurrency issues. This is the approach used by most of the
    ado.net code that I have encountered.
    >
    You can still make pessimistic locking work, but unless you have a really,
    really good reason to do so, you should first consider using optimistic
    locking.
    >
    Kerry Moorman
    >
    >
    "HDI" wrote:
    >
    >Hi,
    >>
    >>
    >I'm writing a windows application where users can update records but
    >how can I lock a record when a user opens it.
    >>
    >With ado and vb6 you can lock the opened record but with ado.net I
    >don't know how to do this.
    >>
    >I am using vb.net and SQL Server.
    >>
    >>
    >thx.
    >>
    >>

    Comment

    • HDI

      #3
      Re: Lock record

      What are the pro's and contra's of optimistic and pessimistic logging?


      Robert Dufour schreef:
      I agree, I've seen cases where a record was locked when it was opened. The
      person going out to lunch, leaving it locked and others who needed access to
      it being unable to get it until he/she came back and released the lock.
      Not a good idea unless you realy think through and handle all the
      unexpected problem scenarios, which is a lot of work.
      >
      Regards,
      Bob
      "Kerry Moorman" <KerryMoorman@d iscussions.micr osoft.comwrote in message
      news:EC368B1F-99E1-40D3-B557-632EBDC876CC@mi crosoft.com...
      HDI,

      The disconnected architecture of ado.net encourages optimistic locking to
      deal with concurrency issues. This is the approach used by most of the
      ado.net code that I have encountered.

      You can still make pessimistic locking work, but unless you have a really,
      really good reason to do so, you should first consider using optimistic
      locking.

      Kerry Moorman


      "HDI" wrote:
      Hi,
      >
      >
      I'm writing a windows application where users can update records but
      how can I lock a record when a user opens it.
      >
      With ado and vb6 you can lock the opened record but with ado.net I
      don't know how to do this.
      >
      I am using vb.net and SQL Server.
      >
      >
      thx.
      >
      >

      Comment

      • HDI

        #4
        Re: Lock record

        What are the pro's and contra's of optimistic and pessimistic locking?


        Robert Dufour schreef:
        I agree, I've seen cases where a record was locked when it was opened. The
        person going out to lunch, leaving it locked and others who needed access to
        it being unable to get it until he/she came back and released the lock.
        Not a good idea unless you realy think through and handle all the
        unexpected problem scenarios, which is a lot of work.
        >
        Regards,
        Bob
        "Kerry Moorman" <KerryMoorman@d iscussions.micr osoft.comwrote in message
        news:EC368B1F-99E1-40D3-B557-632EBDC876CC@mi crosoft.com...
        HDI,

        The disconnected architecture of ado.net encourages optimistic locking to
        deal with concurrency issues. This is the approach used by most of the
        ado.net code that I have encountered.

        You can still make pessimistic locking work, but unless you have a really,
        really good reason to do so, you should first consider using optimistic
        locking.

        Kerry Moorman


        "HDI" wrote:
        Hi,
        >
        >
        I'm writing a windows application where users can update records but
        how can I lock a record when a user opens it.
        >
        With ado and vb6 you can lock the opened record but with ado.net I
        don't know how to do this.
        >
        I am using vb.net and SQL Server.
        >
        >
        thx.
        >
        >

        Comment

        Working...