473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Synchronization Issue

Hi,

I have developed a ASP.NET 2.0 web application and am having a data
access synchronization issue. I would appreciate anybody's
experience. My application is a multi-user application where each
person is working from a queue of work items. They open the app and
click a button which gets the next unprocessed item on the queue and
locks the record for the user by setting an isLocked flag on the
database record. When they are done with the request, they click the
approved button, which changes the processed flag and releases the
lock. My problem is that two people are getting the same work item
and not knowing it (but it is only locked for one of them). Then they
both approve it and the one with the true lock has success and the one
that did not have the lock failed. The database procedure that gets
the next item is as follows:

-- clear all locks for the user
UPDATE work
SET isLocked = 0, -- false / unlock
expirationTime = NULL,
locked_by = NULL
WHERE locked_by = <user>
UPDATE assetholder_address
SET isLocked = 1, -- true
locked_by = <user>,
expirationTime = DateAdd(mi, 30, getdate())
WHERE assetholder_address_id = (
SELECT MIN(work_id)
FROM work aa with (nolock), work_status_status aas with (nolock)
WHERE aa.work_id = aas.work_id
AND aas.address_status_id = @address_status_id -- not processed
AND aa.isLocked = 0
)

-- return the locked address
select @nextAddressID = assetholder_address_id
from assetholder_address
where locked_by = @user

I have a class method call in my ASP.NET component that calls the
procedure that executes the code above.

It looks like this...
nextWorkID= workDBMap.getNextWorkID();

and the getNextWorkID() procedure calles the stored procedure using
ADO.NET.

I know this is a synchronization issue, does anyone have any
strategies for handling things like this in a ASP.NET, SQL Server 2000
environment.

Thanks a lot!

Mar 29 '07 #1
0 885

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

Similar topics

8
by: Eric B. | last post by:
Hi, I'm running into a slight programming issue here that I am hoping someone can help me with. I am developping a web-based PHP application, which means I have to consider multiple threads of...
0
by: Marshal Antony | last post by:
Hi, I have a web service creates a # delimited text file on a server different than the web server per day for tracking databse transactions.All transactions will be writing to this same text...
5
by: Bill Davidson | last post by:
Hello All: I've got a question about synchronization requiremements in a C# worker thread procedure that, among other things, sinks events from outside sources. I realize the worker thread will...
1
by: Bill Davidson | last post by:
(RESEND: I added a little more code to the sample for clarity) Hello All: I've got a question about synchronization requiremements in a C# worker thread procedure that, among other things,...
4
by: scott | last post by:
hi all, Thx to any one that can offer me help, it will be much appreciated. iv got a multithreaded program and need to use thread synchronization. The synchronization does not have to...
0
by: Rod | last post by:
I orginally posted this to microsoft.public.sqlserver.ce but had not received any responses. I have a CF.NET application (C#) with a SqlCE database. We had originally planned to use SQL...
2
by: cristalink | last post by:
The below is perfectly OK in C++, but I wonder how safe is it C#. There are cases when one thread is writing to, another one is reading from the same variable. I don't want/need to synchronize the...
12
by: emma_middlebrook | last post by:
Hi Say you had N threads doing some jobs (not from a shared queue or anything like that, they each know how to do their own set of jobs in a self-contained way). How can you coordinate them so...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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,...
0
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...

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.