Editing Data in a Web Form / Locking the DB Record

G

Guest

Hi,

I have a popup window (aspx) which allows users to edit a database table
record.

If a second user tries to edit the record I want to check if it is being
currently edited / updated and display a message to the user stating that it
is currently being updated.

What is the best way to achieve this?

Thanks.
 
I

itengineer.vaibhav

Hi,

I hope this can be done in following way:
1. When u r popping up the window for editing the record, then set some
Session Variable like Session["Edit"]=1. And when the updation is
finish, set it as False.
2. Now, on checking the value of this variable, u can trace whether
anybody is updating the DB or not.

Bye,
Vaibhav
 
M

Mark Rae

I hope this can be done in following way:
1. When u r popping up the window for editing the record, then set some
Session Variable like Session["Edit"]=1. And when the updation is
finish, set it as False.
2. Now, on checking the value of this variable, u can trace whether
anybody is updating the DB or not.

And what happens if the person accidentally closes their browser without
completing the update...? The record becomes uneditable until the person's
session times out...
 
R

raikinda

Mark Rae yazdi:
I hope this can be done in following way:
1. When u r popping up the window for editing the record, then set some
Session Variable like Session["Edit"]=1. And when the updation is
finish, set it as False.
2. Now, on checking the value of this variable, u can trace whether
anybody is updating the DB or not.

And what happens if the person accidentally closes their browser without
completing the update...? The record becomes uneditable until the person's
session times out...

this is exactly what will happen... using a session variable may not be
real solution, i think. you may use popup close event, if possible...
 
M

Mark Rae

this is exactly what will happen...

I know...
using a session variable may not be real solution,
Correct.

i think. you may use popup close event, if possible...

Hmm - if by "popup" you mean "modal", then that really only works with IE...

Even then, that doesn't get round the (admittedly less frequent) problem of,
say, a power failure on a client which leaves the record in "edit" mode...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top