Trouble with ADO code in global.asa

Results 1 to 2 of 2

Thread: Trouble with ADO code in global.asa

  1. #1 Guest

    Default Trouble with ADO code in global.asa

    I am trying to update a database field in "Session_OnEnd" in my global.asa file. I know that "Session_OnEnd" is getting run after a session timeout of 3 minutes (Session.Timeout = 3) because I have tested it. Yet, the field in my database never gets updated (like the code never gets run). Are there any issues with running ADODB code in the global.asa? Any ideas?<BR><BR>Thanks in advance.<BR><BR><BR>Here is my "Session_OnEnd" in my global.asa file:<BR>========================================= ==============<BR>Sub Session_OnEnd<BR> &#039 Sub Session_OnEnd is the procedure that works<BR> &#039 everytime a user quits the page, this is defined n <BR> &#039 minutes after he quits.<BR> &#039 This n minutes are defined by the Session:Timeout in<BR> &#039 Sub Application_OnStart<BR><BR> &#039 So... when a user quits there will be one less user, so we <BR> &#039 decrement one on the "WhosOn" variable (don&#039t<BR> &#039 forget to Lock/Unlock your application variable! :)<BR> Application.Lock<BR> Application("WhosOn") = Application("WhosOn") - 1<BR> Application.UnLock <BR><BR> &#039 Set UAvailable to False when session end for a user.<BR> Const adLockOptimistic = 3<BR> Const adOpenKeyset = 1<BR><BR> Set Conn = Server.CreateObject("ADODB.Connection")<BR> Conn.Open "mydatabase"<BR><BR> Set Rs = server.createobject("ADODB.Recordset")<BR> set Rs.ActiveConnection = Conn<BR> <BR> <BR> SQLStmt = "UPDATE [Users] SET [UAvailable] = False WHERE ([UID]=16);"<BR> <BR> Rs.Open SQLStmt, , adOpenKeyset, adLockOptimistic<BR> <BR> Conn.Close<BR> set Rs=nothing<BR> set Conn=nothing<BR> <BR>End Sub<BR>=========================================== ============

  2. #2
    Join Date
    Dec 1969

    Default RE: Trouble with ADO code in global.asa

    I&#039ve done the same thing and noticed problems with Session_OnEnd if you&#039re running on a Personal Web Server. PWS seems to run session on end scripts about 40% of the time.<BR>If you&#039re not running the code on a PWS, make sure the application is defined in IIS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts