Forums

ASP

This topic is locked

How to track Users?

Posted 08 Oct 2003 17:40:31
1
has voted
08 Oct 2003 17:40:31 Luis luisantonioirizarry posted:
Hi,
I want to create a counter in the database table of users, that stores the time the users logs in to my web.
Can this be possible?

I create a field in the table, name counter with increment, I am using mssql2000 and asp. I don't want to use a global.asa file. If there is someone that can help me i will be very happy

Replies

Replied 26 Oct 2003 14:52:43
26 Oct 2003 14:52:43 Carl Grint replied:
You can use a Commend Insert to your table.

If you have your uses login you can include their userID and the date.

The commend would simply be to insert into table

Sample:



if(Session("MM_UserID" <> "" then Command1__MMColParam = Session("MM_UserID"


set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_cgwebdb_STRING
Command1.CommandText = "INSERT INTO dbo.cgweb_table (UserID,UserLogin) VALUES (" + Replace(Command1__MMColParam, "'", "''" + ",Now() ) "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()


You would need to alter the login script to pull the UserID and create a session for it, of you can simple change UserID to Username.

Hope this helps

Reply to this topic