This topic is locked

Store users and date time after login

5/31/2009 21:01:44
ASPRunnerPro General questions
W
wisdom2009 author

How can i store the users that logged in without using the DAL .
Thanks

Sergey Kornilov admin 6/1/2009

What do you mean "store the users"?

W
wisdom2009 author 6/2/2009

What do you mean "store the users"?


Insert the username and date when they logged in after a successfully login.

J
Jane 6/3/2009

Hi,
to insert new record to another table use this code:

str = "insert into TableName (field1,field2) values ('" & Session("UserID") &',now())"

dbConnection.Execute str

W
wisdom2009 author 6/3/2009

Hi,

to insert new record to another table use this code:


I received the follwoing error message
Microsoft VBScript compilation error '800a03ea'
Syntax error

C
clig 6/3/2009

DSN:
set CN = server.CreateObject("ADODB.Connection")

CN.Open "DSN=NTSS;UID=user;PWD=pwd"

set rs = Server.CreateObject("ADODB.Recordset")

rs.Open "insert into LoginHistory (LoginName, LoginDate) values (" & "'" & Session("UserID") & "'" & "," & "'" & Now() & "')", CN

CN.Close

set CN = Nothing

set rs = Nothing
using dbconnection:
strSQLInsert = "insert into LoginHistory (LoginName, LoginDate) values (" & "'" & Session("UserID") & "'" & "," & "'" & Now() & "')"

dbConnection.Execute strSQLInsert

  • this is for MSSQL where non Int (varchar etc) needs to be quoted ('foo')

W
wisdom2009 author 6/3/2009

DSN:

set CN = server.CreateObject("ADODB.Connection")

CN.Open "DSN=NTSS;UID=user;PWD=pwd"

set rs = Server.CreateObject("ADODB.Recordset")

rs.Open "insert into LoginHistory (LoginName, LoginDate) values (" & "'" & Session("UserID") & "'" & "," & "'" & Now() & "')", CN

CN.Close

set CN = Nothing

set rs = Nothing
using dbconnection:
strSQLInsert = "insert into LoginHistory (LoginName, LoginDate) values (" & "'" & Session("UserID") & "'" & "," & "'" & Now() & "')"

dbConnection.Execute strSQLInsert

  • this is for MSSQL where non Int (varchar etc) needs to be quoted ('foo')


Thank you very much this worked so perfect thanks again.