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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting users visits

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
US
I did find something on this in the threads, but i am a total dork when it comes to actually picking the booger once someone puts my finger there for me :)
Could someone once and for all clear this up for me. i'm using UltraDev 4, I have a database called TelmonIntranet and a table called IntranetAccounts. In that table i have a field called TotalLogins. Now how (in great booger picking detail) can i increment this TotalLogins field by 1 each time a user logs in.
Thanks in advance guys, this is a great forum :)
 
is your database SQL Server or access? if it's SQL Server, create an SP to do the incrementing for you. if it's access you need to do it in the ASP code.

basically, you would "select max(totallogins) as total from intranetaccounts", increment that number by one, then reinsert it.

In SQL Server (or any DBMS that supports stored procs), its a lot more elegant and efficient, but that's not to say that it can't be done using Access/ASP.

here's an ex, in Access/ASP:
'assume conn = your connection
Dim cnt
set rs = conn.execute("SELECT MAX(totallogins) AS total FROM intranetaccounts")
cnt = rs("total") + 1
conn.execute "INSERT INTO intranetaccounts (totallogins) VALUES (" & cnt & ")"

that'll increment the count for you, using just ASP. In SQL Server, just adapt the two statements into your login proc (you do have a login proc, don't you? :) ) and you're done.

hth

leo

------------
Leo Mendoza
lmendoza@students.depaul.edu
 
Leo,

Do you mean UPDATE instead of INSERT.

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top