session_onend and databases
I was using a DSN to access my access database, wrote all the code and it all worked perfectly - I've since changed it to a DSNless connection as it's faster - the whole site is fine with this, except for the session_onend in global.asa
function Session_OnEnd() {
var dbConnEnd = Server.CreateObject("ADODB.Connection");
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\path\to\database.mdb;Jet OLEDB:Database Password=passwd";
dbConnEnd.Open(connStr);
sql = "update tblUser set loggedin=no,where id = " + Session("id") + ";";
dbConnEnd.Execute(sql);
dbConnEnd.Close();
dbConnEnd = null;
}
This is to make sure that users that don't use the logout get loggedout when their session ends, only it's not working at all...is there some kinda rule about using database connections in session_onend? Or am I missing something important? I have no idea why it's not working...and it's very frustrating!
|