Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: End Session


Message #1 by "John P. Miller" <jpmiller@a...> on Wed, 29 Aug 2001 16:17:52 -0400
I have a list of users in my database, I can set a checkbox in my table 

to true when the user logs in. I want to reset the value to false when 

the user's session ends. How do I do this? The following is the code I 

used to set the active field to true:

<% User =3D request("username") %>



<%



strConnect =3D "Provider=3DMicrosoft.JET.OLEDB.4.0;Data 

Source=3Dd:\database\Mhaaccs.mdb"



Set objConn =3D Server.CreateObject("ADODB.Connection")



objConn.Open strConnect



SQLQueryActive =3D "Update tblUsers set utActive =3D -1 where utUserID 

=3D '"



SQLQueryActive =3D SQLQueryActive & User



SQLQueryActive =3D SQLQueryActive & "'"



Set rsActiveUser =3D Server.CreateObject("ADODB.RecordSet")



rsActiveUser.Open SQLQueryActive, objConn,adOpenStatic,,adCmdText



%>



Thank You,



John Miller



Message #2 by "Mike Scott" <jstmehr4u3@h...> on Wed, 29 Aug 2001 14:17:18 -0700
Does the command below actually work? I don't believe it should, only

because the UPDATE command does not return a recordset. You might want to

try and use a Conn.Execute(SQLQUERYACTIVE), that should work as well. Also

your field type is a true/false? -1 being true and 0 being false? Why not

put code in your global.asa file that executes on Session END. Then you can

use the same update command, except this time set it to your False value.





Mike



----- Original Message -----

From: "John P. Miller" <jpmiller@a...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Wednesday, August 29, 2001 1:17 PM

Subject: [asp_web_howto] End Session





I have a list of users in my database, I can set a checkbox in my table to

true when the user logs in. I want to reset the value to false when the

user's session ends. How do I do this? The following is the code I used to

set the active field to true:

<% User = request("username") %>



<%



strConnect = "Provider=Microsoft.JET.OLEDB.4.0;Data

Source=d:\database\Mhaaccs.mdb"



Set objConn = Server.CreateObject("ADODB.Connection")



objConn.Open strConnect



SQLQueryActive = "Update tblUsers set utActive = -1 where utUserID = '"



SQLQueryActive = SQLQueryActive & User



SQLQueryActive = SQLQueryActive & "'"



Set rsActiveUser = Server.CreateObject("ADODB.RecordSet")



rsActiveUser.Open SQLQueryActive, objConn,adOpenStatic,,adCmdText



%>



Thank You,



John Miller




  Return to Index