Re: Pessimistic Locking

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



> -Is there any possibility to prevent other clients to read the locked data
> which is being updated?

Yes, right before your insert/update/delete .. run a Select (HOLDLOCK)

> -Is it possible to tell another client that this row is locked and
> therfore cannot be updated instead of simply blocking the update
> operation?

Yes, run the other client in serializable isolation level - he will deadlock
and be made the deadlock victim.

> -How can I know that the row cannot be updated when I populate the form
> with the data read from the locked row.

Whoaa !! I don't understand this one .. "with the data read from the locked
row" .. if the row is locked, how did you read the data ;-)

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----------------------------------------------------------------------------

"Ferdinand Zaubzer" <ferdinand.zaubzer@xxxxxxxxxx> wrote in message
news:%23C6EWH2%23FHA.3136@xxxxxxxxxxxxxxxxxxxxxxx
>I would like to use pissimistic locking for changing data on a database.
>(Yes, I know what I'm doing, it will scale poorly!)
>
> I tried it using a transaction with Isolationlevel "serializable".
> I set the select, insert, update and delete command of the DataAdapter to
> use this transaction.
>
> If I open a Row for editing, any other client trying to change the same
> row is blocked. But it is still possible to read the row which is locked
> for editing.
>
> So I have the following questions:
>
> -Is there any possibility to prevent other clients to read the locked data
> which is being updated?
>
> if not:
>
> -Is it possible to tell another client that this row is locked and
> therfore cannot be updated instead of simply blocking the update
> operation?
>
> -How can I know that the row cannot be updated when I populate the form
> with the data read from the locked row.
>
> Cheers
> Ferdinand


.



Relevant Pages

  • Re: AARGGH!! How to store data - HEEELLLPP!
    ... There are ways to populate the Issue table automatically when you add a new mag. ... If you wish, I can explain how to create such an append query: let us know if ALL your products will only ever be monthlies, of if you anticipate the could be weeklies, quarterlies, etc. ... Client table, ...
    (microsoft.public.access.tablesdbdesign)
  • RE: Prompt to select from a list in another workbook
    ... While creating a new maintenance job in my register I will prompt the user ... JobNo, Client Name, Address etc. ... ' Ascertain the top row of items to populate the main list ... ' Define an array used to hold the items in the list so that it is big ...
    (microsoft.public.excel.programming)
  • Re: combo box, drop down - dynamic populate
    ... The ClientID is not coming into the userform. ... Am I right that you use the client ID in the query string strquery4 ... I know how to sql the databases but unsure of how to populate the ...
    (microsoft.public.word.vba.general)
  • Re: Pessimistic Locking
    ... A normal select statement executed in a transaction with serializable ... run the other client in serializable isolation level - he will deadlock ... With this data I could populate the form for editing ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Populate Datagrid from Client side
    ... To populate on client side is not a problem. ... DataGrid renders to a. ... You just need to navigate through table rows and cells in javascript, ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)