Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript recordset problem

Status
Not open for further replies.

cm80

Technical User
May 3, 2001
85
US
Hi,
my problem is kind of hard to explain but I hope everyone is able to understand. If anyone doesn't, please feel free to ask questions because I am really stuck with this one and basically could do with all the help I can get!

Basically, I am working on a tool that tracks our users' usage of an application and what I am trying to do at the moment is use VBScript to list the last ten sessions for a particular user.

What I eventually want to end up is the following format:
eg
Session Started Session Ended
2:34 PM 2:50PM
3:35 PM 4:15PM
etc...


Every single request that a user makes is tracked in a database so I am using a recordset object to retrieve the results
My SQL statement is as follows:
sql = "SELECT * FROM event_log" & _
"WHERE (event_id = 1 OR event_id = 2 OR event_id = 10 OR event_id = 0)" & _
"user_id="ABC" & _
"ORDER BY event_time DESC"

The event_id's mean the following:
1 = login success
2 = login failure
10 = logout
0 = regular page request once the user is logged in


A session start with a login failure or if there is none, a login success
A session ends with either a logout or when the last request was more than 20 minutes ago

The easiest way to explain is to give an example of a recordset and show the expected results

Event# event_time event_id
1 2:34 0
2 3:05 2
3 3:07 2
4 3:08 1
5 3:09 0
6 3:11 10
7 3:15 1
8 3:16 0
9 3:17 0
10 4:55 1
. . .
. . .
13 5:05 10

The expected results from the recordset above would be:
1. Session Started: 3:05 PM (because a user can login unsuccessfully more than once)
Session Ended: 3:11PM (logout)

2. Session Started: 3:15 PM (login)
Session Ended: 3:17PM (because the next request after this is more than 20 minutes)

2. Session Started: 4:55 (login)
Session Ended: 5:05 (logout)

Sorry, I know that is a bit long winded but it's the best way I could explain.
I don't expect anyone to go away and write the entire code required for this but I would appreciate any advice anyone would have,
Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top