Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / June 2009



Tip: Looking for answers? Try searching our database.

Mulitple users accessing same record - how to work out

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 18 Jun 2009 13:22 GMT
I am building an application using classic ASP that may be used by
multiple users at a time.  What are the methods for working this out?

For example, if User A opens the application and selects a record,
they can be working on the record as it existed when they opened it.
But if User B was to open the application, select the same record as
was opened by User A and edits and submits the form, then User A is
not aware of the changes made.

Thanks,
Drew
MikeR - 18 Jun 2009 14:09 GMT
> I am building an application using classic ASP that may be used by
> multiple users at a time.  What are the methods for working this out?
[quoted text clipped - 7 lines]
> Thanks,
> Drew

Look in the documentation for the DB you're using for record locking. Some do it
automagically. Google it also.
Mike
Joe - 18 Jun 2009 14:44 GMT
> > I am building an application using classic ASP that may be used by
> > multiple users at a time.  What are the methods for working this out?
[quoted text clipped - 11 lines]
> automagically. Google it also.
> Mike

Thanks for the reply, having a term to search will make this easier.

Thanks,
Drew
Sylvain Lafontaine - 20 Jun 2009 19:03 GMT
ASP pages are stateless, so you can't use the usual database record locking
mecanisms and even if they were, you couldn't still use them because if you
set a lock on a record but the user don't post back his data, that record
will remain locked for everyone else (and possibly even for the primary
user; depending on the mecanism used for the record locking.

When using a web server, you must be very careful if you want to implement
any locking mecanism.  For example, you could set a flag with a time limit
somewhere using a stored procedure to make sure that not two user got the
same flag at the same time.  Passed that delay, the flag is invalided for
anyone else who may want to take it.

When the user post back his data, the flag is first checked to see if it's
still valid; ie., it has not been granted to someone else because of an
expired delay.

If necessary, you can add some AJAX code into your HTML page so that the
record will get renewed at a regular interval but you must be very careful
about that as you never know when an user will simply walk away for an
extended period of time.

Instead of using a SP for etablishing your own locking flags, you can also
use  Application.Lock() and Application.UnLock() - see
http://www.java2s.com/Code/ASP/Session-Cookie/ApplicationLockandunLockVBnet.htm -
but it's not recommended in term of performance.

Signature

Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)

On Jun 18, 9:09 am, MikeR <nf4lNoS...@pobox.com> wrote:
> Joe wrote:
> > I am building an application using classic ASP that may be used by
[quoted text clipped - 13 lines]
> automagically. Google it also.
> Mike

Thanks for the reply, having a term to search will make this easier.

Thanks,
Drew
Daniel Crichton - 22 Jun 2009 09:17 GMT
Joe wrote  on Thu, 18 Jun 2009 05:22:25 -0700 (PDT):

> I am building an application using classic ASP that may be used by
> multiple users at a time.  What are the methods for working this out?

> For example, if User A opens the application and selects a record, they
> can be working on the record as it existed when they opened it.
> But if User B was to open the application, select the same record as
> was opened by User A and edits and submits the form, then User A is not
> aware of the changes made.

> Thanks,
> Drew

You could create a checksum of the original data and store this as a hidden
field in the form so when the user posts the changes back it compares the
checksum with the data in the database and if they don't match then you know
something else has edited it during the time the user had it open. What you
do then is where it could get tricky - the simple solution would be just to
tell the user that the changes could not be made because another user has
edited the data and send the new data back to the user along with the new
checksum which would then allow them to make any further changes and try
posting again. Any method that would involved merging or determining if the
current user should have their changes override the other user will be a lot
more complex to handle.

Signature

Dan

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.