472,984 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 software developers and data experts.

Ado.net and Locking

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
Dec 7 '05 #1
1 1354
>I would like to use **pissimistic** locking for changing data on a
database.
Water and electronics don't mix ;-)
-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.ma.../13/63199.aspx
----------------------------------------------------------------------------

"Ferdinand Zaubzer" <fe***************@schendl.at> wrote in message
news:O8***************@tk2msftngp13.phx.gbl...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

Dec 7 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Chermside | last post by:
Ype writes: > For the namespaces in Jython this 'Python internal thread safety' > is handled by the Java class: > > http://www.jython.org/docs/javadoc/org/python/core/PyStringMap.html > > which...
3
by: Ryan | last post by:
I have a problem with record locking / blocking within an application. The app is quite straight forward. Written in Delphi 5 using BDE to access a SQL 7 database (Win2K server). Every so often...
9
by: john smile | last post by:
Hi All, I want to lock 2 tables on 2 servers using TABLOCKX hint. These tables function as semaphores in my application. It means when the tables are locked then other users will not be able to...
16
by: Nid | last post by:
How do I do row-level locking on SQL Server? Thanks, Nid
10
by: McFly Racing | last post by:
Thread Locking In Static Methods I have the need for a Log Manger class that has static methods. Normally I would use the lock statement or a Monitor statement both of which take a...
15
by: z. f. | last post by:
Hi, i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL. for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it...
7
by: Shak | last post by:
Hi all, I'm trying to write a thread-safe async method to send a message of the form (type)(contents). My model is as follows: private void SendMessage(int type, string message) { //lets...
0
by: xpding | last post by:
Hello, I have a class MyEmbededList contains a generic dictionary, the value field is actually the MyEmbededList type as well. There is another class need to access and manipulate a list of...
0
by: Cindy Huyser | last post by:
I have an Access 2000 database behind a threaded Java application that that can have have concurrent access to the same table (but not the same record). The database is set up for shared access...
1
by: Paul H | last post by:
I have an Employees table with the following fields: EmployeeID SupervisorID Fred Bob Bob John Bob Mary Bill Bill I have created a self join in...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.