473,671 Members | 2,363 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 1904
I would say most go with an optimistic locking strategy.

http://www.google.com/search?hl=en&q...tic+locking%22
"John Walker" <Jo********@dis cussions.micros oft.comwrote in message
news:83******** *************** ***********@mic rosoft.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********@dis cussions.micros oft.comwrote in message
news:83******** *************** ***********@mic rosoft.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, MyTimeStampColu mn) as
MyTimeStampColu mnAsBigInt, LastName, FirstName from dbo.Employee

something like that.

"John Walker" <Jo********@dis cussions.micros oft.comwrote in message
news:8B******** *************** ***********@mic rosoft.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********@dis cussions.micros oft.comwrote in message
news:83******* *************** ************@mi crosoft.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
4043
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 (attempts to lock it), user B will get an error saying this record cannot be locked now. It seems like Access 97 is doing optimistic record level locking. In above scenario user B, is allowed to edit the record but when tries to
0
4040
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 appears. When we close the Access database, the icon disappears. However now all of the sudden, the Microsoft Access Record-Locking
0
1923
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 property > RecordLock = Edited Record. However, the record is still NOT locked. Multiple users can still open
1
1673
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 "Open Database Using Record-Level Locking" and the default record lock setting is "Edited Record". My forms' record lock setting is also "Edited Record". With the above settings, I get page-level locking. Can pessimistic
1
4846
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 locking, but it's not working quite as I expected. I've read all over, and by now have posted elsewhere on this subject, and (strangely it would seem) have made no progress. This seems to be a bit of a blank spot on the map. (Access 2000-2003,...
22
18791
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. The system is client/server, multiusers based. The MDBs are using record locking. Here is part of the code: Dim wkSpace As Workspace, db As Database Dim rstTrans As DAO.Recordset Set wkSpace = DBEngine.Workspaces(0)
9
2646
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 data. And there is an Intranet ASP.NET application which is an interface to the database in question... and there are 100 pretty girls eager to... uhmm... use the application and validate the data of course ;-). The task is to enable the data...
0
4096
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 with "No locks" as the default, so that optimistic record locking should take place, and "Open databases using record-level locking" is selected. Each Java thread gets a new connection to the database, then updates its record. One of my users has...
1
2224
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 the relationships window, with
19
4021
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 first. The only way I can think of is by adding a flag to the record and setting it to true when user-1 opens the record. If user-2 tries to open it, the flag is checked for true, then a message would be displayed to them that user-1 is on the...
0
8471
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8907
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8663
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7423
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2804
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 we have to send another system
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.