Re: row edited by more than one user at same time

From: Brian Bushay TeamB (BBushay_at_Nmpls.com)
Date: 05/13/04


Date: Wed, 12 May 2004 22:51:51 -0500


>What is the easiest and "cleanest" way to solve problem of two users trying
>edit the same record.
>When I try to do this the second user gets error "row changed while
>updating" or sthing like this.
What you are experiencing is the SQL server default of Optimistic locking.
With optimistic locking the record is locked only when it is being posted.
Depending on how the ADO Update Criteria property is set the error you are
getting may be triggered when another user has changed the record when you go to
post it.
If you simply want to always post the record with no warning that it has changes
set the Update Criteria to adCriteriaKey.
Or if you initial post fails because another user has changed it check if the
user wants to over write the record and then change the update Criteria

>I have some ideas:
>1. Some kind of locking the row
SQL server does pessimistic locking but not as easily as pessimistic locking and
only if you use server side cursors which will affect the saleability of SQL
server

>2. Time stamps (additional field where is stored some information from that
>you can get the post rights)
I don't see how this would help.
>3. stored procedure that will handle the updating
More complicated than just changing the UpdateCriteria.

>4. handle isolation levels (know nothing much about it)
Not something you want to do during a user edit.
>Which approach is used most? Which is the "best"?
>
>The result should be that no user will be working on data that won't be able
>to post.
>
>The problem is generic but I am interested especially in MS SQL Server
>solution.

--
Brian Bushay (TeamB)
Bbushay@NMPLS.com


Relevant Pages

  • Re: row edited by more than one user at same time
    ... > What you are experiencing is the SQL server default of Optimistic locking. ... > Depending on how the ADO Update Criteria property is set the error you ... > Not something you want to do during a user edit. ...
    (borland.public.delphi.database.ado)
  • Re: Error 3155- Is there no solution?
    ... You might want to look at all processes that use the Materials table - ... Whatever is creating the conflict is most likely locking the table to ... How could anyone use SQL Server in a useful way if tables ... the end of the day to append any records that weren't already in the main ...
    (microsoft.public.access.externaldata)
  • Re: row vs page locking...
    ... so they automatically escalate to page level locks. ... 'Lock Escalation' - see Books Online. ... SQL Server 2005 is going to have a Snapshot ... Good old fashioned locking is less sexy, but I find, more productive! ...
    (microsoft.public.sqlserver.server)
  • Re: Record Locking with SQL Server tables and Access db Client
    ... The reason you don't get the same kind of locking with SQL Server as ... When a user starts to edit a record via the form, ... With SQL Server tables there is only a warning when the second person ... eliminate the ODBC usage at this time is not feasible. ...
    (microsoft.public.sqlserver.odbc)
  • Re: row vs page locking...
    ... whether SQL Server really did row locking. ... > the Hands-On SQL server 2000 Troubleshooting:Locking and Blocking. ... >> Kalen Delaney ... >>>> internals classes. ...
    (microsoft.public.sqlserver.server)