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!

global.asa problems

Status
Not open for further replies.

MikeBronner

Programmer
May 9, 2001
756
US
I tried using the global.asa file, which contains the following:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Session_OnEnd
SET conn = SERVER.CREATEOBJECT(&quot;ADODB.Connection&quot;)
conn.OPEN &quot;DRIVER=SQL Server;SERVER=mssql.homestead.wellsfargo.com;Trusted_Connection=No&quot;,&quot;my_user_id&quot;,&quot;my_password&quot;
SET resultSet = ExecStmt(&quot;UPDATE users SET logged_on = 0 WHERE user_id = &quot; & SESSION(&quot;login&quot;))
conn.CLOSE
SET conn = NOTHING
END SUB
</SCRIPT>

However, it doesn't work. Do you see anything I am missing? One thing I am wondering is if I can reference SESSION elements in the OnEnd section.

My intent is to update the database to reflect who is logged in and who isn't. So I want the Session_OnEnd to do this for me when the user ends his or her session by closing the browser or timing out.

Thanks for all your help! Take Care,
Mike
 
What is ExecStmt()?

Maybe -
Code:
Dim cmdUpdate
Set cmdUpdate = Server.CreateObject(&quot;ADODB.Command&quot;)
cmdUpdate.ActiveConnection = conn
cmdUpdate.CommandText = &quot;UPDATE users SET logged_on = 0 WHERE user_id = &quot; & SESSION(&quot;login&quot;)
SET resultSet = cmdUpdate.Execute()
 
This should work - it is one of the only things you can do on_end though - FileSystem seems to be unavailable.

Are you sure you have waited for re-compile?

[bb]
 
rac2, thanks for pointing that out. I totally spaced that I had a custom function in there. I fixed that and it now works perfectly ;-) Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top