473,513 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET, SQL Record Locking

Hi.
Is there a convenient way to lock SQL records so that two users cannot
attempt to update the same row, thereby preventing users from overwriting
other user's data?
For example, we have a asp.net 2.0 application which allows a user to pull
up customer information, modify their information and save it back to the
database. if there is a different user attempting to pull up that same
customer record while the other user is viewing it in their browser we would
like to display a message "the customer record you are trying to access is
currently locked by another user."
We may also want to give each user a certain amount of time to have a record
locked before releasing it for access by other users.
Any advice would be appreciated.
Thanks!
John
Jun 27 '08 #1
3 1897
I would say most go with an optimistic locking strategy.

http://www.google.com/search?hl=en&q...tic+locking%22
"John Walker" <Jo********@discussions.microsoft.comwrote in message
news:83**********************************@microsof t.com...
Hi.
Is there a convenient way to lock SQL records so that two users cannot
attempt to update the same row, thereby preventing users from overwriting
other user's data?
For example, we have a asp.net 2.0 application which allows a user to pull
up customer information, modify their information and save it back to the
database. if there is a different user attempting to pull up that same
customer record while the other user is viewing it in their browser we
would
like to display a message "the customer record you are trying to access is
currently locked by another user."
We may also want to give each user a certain amount of time to have a
record
locked before releasing it for access by other users.
Any advice would be appreciated.
Thanks!
John


Jun 27 '08 #2
That may be what i need.
Thank you!

"sloan" wrote:
I would say most go with an optimistic locking strategy.

http://www.google.com/search?hl=en&q...tic+locking%22
"John Walker" <Jo********@discussions.microsoft.comwrote in message
news:83**********************************@microsof t.com...
Hi.
Is there a convenient way to lock SQL records so that two users cannot
attempt to update the same row, thereby preventing users from overwriting
other user's data?
For example, we have a asp.net 2.0 application which allows a user to pull
up customer information, modify their information and save it back to the
database. if there is a different user attempting to pull up that same
customer record while the other user is viewing it in their browser we
would
like to display a message "the customer record you are trying to access is
currently locked by another user."
We may also want to give each user a certain amount of time to have a
record
locked before releasing it for access by other users.
Any advice would be appreciated.
Thanks!
John


Jun 27 '08 #3

As a followup, I now convert the timestamp/rowversion column to a bigint
when I pull it up to the webpage.

I've seen some other tricks, but that one works for me.

Select EmpID, convert(bigint, MyTimeStampColumn) as
MyTimeStampColumnAsBigInt, LastName, FirstName from dbo.Employee

something like that.

"John Walker" <Jo********@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.com...
That may be what i need.
Thank you!

"sloan" wrote:
>I would say most go with an optimistic locking strategy.

http://www.google.com/search?hl=en&q...tic+locking%22
"John Walker" <Jo********@discussions.microsoft.comwrote in message
news:83**********************************@microso ft.com...
Hi.
Is there a convenient way to lock SQL records so that two users cannot
attempt to update the same row, thereby preventing users from
overwriting
other user's data?
For example, we have a asp.net 2.0 application which allows a user to
pull
up customer information, modify their information and save it back to
the
database. if there is a different user attempting to pull up that same
customer record while the other user is viewing it in their browser we
would
like to display a message "the customer record you are trying to access
is
currently locked by another user."
We may also want to give each user a certain amount of time to have a
record
locked before releasing it for access by other users.
Any advice would be appreciated.
Thanks!
John




Jun 27 '08 #4

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

Similar topics

1
4032
by: Fardude | last post by:
ACCESS 97, Pessimistic Record Locking!??? Does Access 97 allow record level Pessimistic locking? In other words, when user A is editing a record (has it locked) and User B tries to edit it...
0
4022
by: Megan | last post by:
Hi- I have a question about the Microsoft Access Record-Locking Information Icon. Whenever I, or my friends, open my MS Access database, the Microsoft Access Record-Locking Information Icon...
0
1910
by: ethanj /personal/ | last post by:
We are using Access 2000 database, with the following settings. Tool > Options > Advance > Default Record Locking = Edited Record Open databases using record level locking = True Form...
1
1667
by: jv | last post by:
Hello, I'm using A2K and am trying to make sure that my program only locks one record at a time and I don't seem to have any luck getting that to happen. In the database options, I've selected...
1
4841
by: wheel | last post by:
I have been ok with optimistic locking most of the time but I have a situation now where there is more of a chance that users could try to edit a record at the same time. I'd like to use pessimitic...
22
18764
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
9
2632
by: master | last post by:
Actually, it is not only the record locking, what I need, and nobody seems to descibe this. Imagine the following scenario. There is a database with, say 10000 records with some unvalidated...
0
4086
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
2217
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...
19
4006
by: emanning | last post by:
Using Access 2003 and using a form that's mostly bound. I need a way to tell if user-1 is on the record when user-2 tries to open the same record, w/o waiting for the user-1 to save the record...
0
7257
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
7535
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
7521
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
5682
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
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
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
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
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.