本文介绍了代码在global.asa中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嗨 我的login.asp中有代码将用户数据库中的在线字段设置为 true或1.我正在尝试使用global.asa中的相同代码将 在线字段更改为0但它不起作用。代码非常简单,它应该是b $ b工作,任何想法为什么它不是? Sub Session_OnEnd 如果会话(QUOT; USER_ID")<>" "然后''检查用户是否已登录 。 ConnectionString =" Driver = {SQL Server}; UID = emenworldcom2;密码= BBBBBB; DATABASE = Mydatabase; SERVER = 111.111 ..111.11 \ i1" 设置Conn2Gallery = Server.CreateObject(" ADODB.Connection") 设置CmdTrackUser = Server.CreateObject(" ADODB.Recordset") Conn2Gallery.Open ConnectionString SQL.CommandText =" SELECT Users。* FROM Users WHERE(User_ID ="& Session(" User_ID")&")" SQL.CommandType = 1 设置SQL.ActiveConnection = Conn2Gallery CmdTrackUser.Open SQL ,, 1,3 CmdTrackUser.Fields(" Online")= 0 CmdTrackUser.Update CmdTrackUser.Close 设置CmdTrackUser = Nothing Conn2Gallery.Close 设置Conn2Gallery =没什么 END IF 解决方案 HiI have code in my login.asp which sets the online field in user database totrue or 1. I am trying to use the same code in global.asa to change back theonline field to 0 but it doesn''t work. The code is very simple and it shouldwork, any idea why it doesn''t?Sub Session_OnEndIf Session("User_ID")<>" " Then '' check if user has logged inbefore.ConnectionString = "Driver={SQLServer};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111.111..111.11\i1"Set Conn2Gallery = Server.CreateObject("ADODB.Connection")Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")Conn2Gallery.Open ConnectionStringSQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &Session("User_ID") & ")"SQL.CommandType = 1Set SQL.ActiveConnection = Conn2GalleryCmdTrackUser.Open SQL, , 1, 3CmdTrackUser.Fields("Online") = 0CmdTrackUser.UpdateCmdTrackUser.CloseSet CmdTrackUser = NothingConn2Gallery.CloseSet Conn2Gallery = NothingEND IF 解决方案 这篇关于代码在global.asa中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-14 07:47