473,498 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADO.Net: how to lock records for update? options?

Hi,

I know ADO.Net recommand using disconnected update
(optimistic concurrency) for good reasons, but it's just
not an option for us. 99% of our clients would rather
seeing "record locked" kind of message up front when they
load records, than being told "updating failed" after they
spend all the time entering their data.

So here I am spending a lot of time trying to find a good
way to do the "read with lock" type of opration. I know
that I can do some thing like that at query level if I am
running some late version of SQL server, but what if I
can't use those DB specific features? Is there a
recommanded way of doing this at ADO.Net level"? What
about ADO.Net's transaction?

If someone can point me to a right direction that would be
highly appreciated!

Thanks

Feng
Nov 20 '05 #1
4 6225
* "feng" <an*******@discussions.microsoft.com> scripsit:
I know ADO.Net recommand using disconnected update
(optimistic concurrency) for good reasons, but it's just


You will more likely get an answer here:

<URL:news://news.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<URL:http://msdn.microsoft.com/newsgroups/?dg=microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
feng,
In addition to Herfried's comments.

You may want to look at the Pessimistic Offline Lock pattern.

http://www.martinfowler.com/eaaCatal...flineLock.html

For details on the Pessimistic Offline Lock pattern and other useful
patterns see Martin Fowler's book "Patterns of Enterprise Application
Architecture" from Addison Wesley.

http://www.martinfowler.com/books.html#eaa

Note: Fowler's book in C# & Java, however it should be easily converted to
VB.NET.

Hope this helps
Jay

"feng" <an*******@discussions.microsoft.com> wrote in message
news:1e*****************************@phx.gbl...
Hi,

I know ADO.Net recommand using disconnected update
(optimistic concurrency) for good reasons, but it's just
not an option for us. 99% of our clients would rather
seeing "record locked" kind of message up front when they
load records, than being told "updating failed" after they
spend all the time entering their data.

So here I am spending a lot of time trying to find a good
way to do the "read with lock" type of opration. I know
that I can do some thing like that at query level if I am
running some late version of SQL server, but what if I
can't use those DB specific features? Is there a
recommanded way of doing this at ADO.Net level"? What
about ADO.Net's transaction?

If someone can point me to a right direction that would be
highly appreciated!

Thanks

Feng

Nov 20 '05 #3
Hi Feng,

Please do not multipost, you can crosspost, to dotNet groups, you have sand
this message some minutes before this to the ADONET newsgroup (a good place
for this question by the way).

You can without any problem, when the subject is proper for that, crosspost
to dotNet newsgroups, that means one message to more newsgroups in one time.

In addition to the others, have as well special for this subject a look what
William (Bill) Vaughn is writting about it.

He has a website and there you can find a link to his book and articles. He
has a basicly a different idea than you about pesimistic and optimistic
concurrency (what I share with him), however it is better when you read it
yourself. He is with David Sceppa one of the major bookwritters about
AdoNet.

http://www.betav.com/

I hope it gives you some idea's

Cor
Nov 20 '05 #4
Ahh .. so you've been stung by the "User designing the application" bee.
You've gotta prevent that from happening my man. A too smart for his own
good user is actually dangerous - my pet peeve about Extreme Programming.
(No my pet peeve is keyboard sharing .. whats next picking each other's
noses as we program?)

My first recourse would be to not using pessimistic locking, since that is
ultra unscaleable. Not only that, in an enterprise app, you would be keeping
your DBAs awfully busy clearing out locks for everyone. Might I add, you can
avoid that to some extent by better table design .. but you will be safe,
not immune. You could however implement concurrency control rather well in
..NET. (Ask me if thats an option and I'd be glad to tell you how). You can
always show a message box that "someone else updated ur row" .. (so it won't
exactly be like "Record is locked").

My second recourse is to try and tell them that "Hey I don't tell you to do
your job, so let me do mine". So if this were a financial application, walk
upto the CFO and say "Hey moron, I never asked you to file for a shelf
registration ... So why are you asking me to build in pessimistic locking?".
If it helps take a few pictures of the CFO fooling around with his secretary
with a hidden cam.

My third recourse would be to threaten suicide (just kidding don't do it).

My final recourse would be to implement pessimistic locking as the two MVPs
before me replied.

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/

"feng" <an*******@discussions.microsoft.com> wrote in message
news:1e*****************************@phx.gbl...
Hi,

I know ADO.Net recommand using disconnected update
(optimistic concurrency) for good reasons, but it's just
not an option for us. 99% of our clients would rather
seeing "record locked" kind of message up front when they
load records, than being told "updating failed" after they
spend all the time entering their data.

So here I am spending a lot of time trying to find a good
way to do the "read with lock" type of opration. I know
that I can do some thing like that at query level if I am
running some late version of SQL server, but what if I
can't use those DB specific features? Is there a
recommanded way of doing this at ADO.Net level"? What
about ADO.Net's transaction?

If someone can point me to a right direction that would be
highly appreciated!

Thanks

Feng

Nov 20 '05 #5

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

Similar topics

5
7924
by: xixi | last post by:
hi, i am using db2 udb v8.1 on windows, i create a index on a unique value column on a table to try to create row lock, here is what i do , sql = select value from table where id=1 for update,...
4
6017
by: xeqister | last post by:
Greetings, We are connecting to a DB2 database residing on an AIX machine via JDBC. In order to lock some row of records, we use the "select . . . for update . . . " Java statement: In a...
8
2833
by: Bri | last post by:
Greetings, After making various edits and deletes on aproximately 40,000 records in one table (on the Design Master) syncronization fails with Error 3052 - File Sharing Lock Count Exceeded....
2
5847
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
0
3633
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and...
0
3818
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested...
1
1189
by: =?Utf-8?B?QW1lbGlh?= | last post by:
Hello, Apologies for the easy coding questions but I have something I need to code in .Net and am fairly new to coding and don't want to produce bad code so after some advice from the...
6
3637
by: jmartmem | last post by:
Greetings, I have an Access 2002 continuous form called "Project Update Form" in which users can update project values presented in a series of combo boxes and text boxes. Three of the combo...
25
14815
by: zmickle | last post by:
Excuse my noobness. I am managing an access database that is shared by 4 users. Management does not want to use any technologies outside of access for this application (no SQL Server, etc). I...
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.