View Full Version : ASP Database to avoid duplicate work

11-30-2007, 01:53 PM
having a database to insert and select let's you be able to edit, add and delete information. But if this page is accessible to several employee's and you want to somehow add a button or a read only method that lets other know that someoned is currently viewing/working on this profile, so that you can select another record from the list, is there a way to do this?

12-03-2007, 07:17 PM
if this can't be done in ASP, maybe in javascript?

where it would say: Status: Open [means someoned is accessing the URL]
or Status: Close [the file is available to view]

ID Contact Name Delete Status: Close <---example, if the status is open, that means the person will get an alert when trying to click on the link "contact name"

I dont have a code for this, has I dont even know if it is possible to do so.

Whatever Jr.
12-04-2007, 07:42 AM
What if a user open a record and doesn't edit it for hours? Or if they close the browser window? How can you tell if the record is still in use?


12-04-2007, 04:26 PM
the records is display in a .asp file, so if an IT person is viewing the page, it will have to detect that this URL (ID) is currently open, if not it is available?

something like:

<a href="databasesite.asp?id=<&#37;= rsdatas("ID") %>">Name</a>

is restricted to only 1 user to click on that specific ID, if ID45 is open by a user (IP detection) then another ID from the list might be available to view.

any idea?

12-04-2007, 05:02 PM
You'll need to add fields to your record for both the timestamp of when the record was requested for updating, and for the session ID of the user that did the requesting. You need to allow for users making multiple requests, and for users that don't end their sessions as expected; this last one is especially problematic as you can't rely on Session_OnEnd firing on all occassions. So you're going to need to check, when someone requests a record for updating, not only whether another user has got it 'open' but when they 'opened' it - and if that users' session can be reasonably expected to have expired in the meantime, thus enabling you to 'close' all the records opened under that session ID.

In short, it's a bit complicated. :)

Whatever Jr.
12-04-2007, 05:59 PM
@Spudhead: That's what I was trying to explain to the OP. And how do you test for expired sessions when the user has left your site?


12-04-2007, 06:40 PM
perhaps there is a site that explain the process of doing so...if I would to search, what title would I use to search:

expired sessions
database id record restriction

Whatever Jr.
12-04-2007, 06:50 PM

Here's you'll find a example in dutch:


Even without understanding the explanation it's pretty straightforward. The last part warns about the problem mentioned by Spudhead.

HTH, Tom

12-04-2007, 08:23 PM
thanks, Ill look into it, and I dont understand dutch, if you find an english page, let me know ;)