回 帖 发 新 帖 刷新版面

主题:[求助]为什么总是不对??

我作的考勤登录网页,用几个时间字段和Iswork来限制重复登录,但调试时总是显示:[color=FF0000]缺少对象: 'Session(...)'
/MyHome/index.asp, 第 37 行(下面粗体兰色的那行)[/color]想请各位高手前辈看看问题出哪儿了?代码如下(不重要的省了):
(部分省略)
Function IsOnline(user)
   Dim mysql
   mysql ="SELECT * FROM kaoqing_table WHERE user='"&username&"' and recordYear="&Year(Now())&" and recordMonth="&Month(Now())&" and recordDay="&Day(Now())&""
   [b][color=0000FF]Set objRS = Session("objRS")[/color][/b]
   objRS.Source = mysql
   objRS.Open
   
   If Iswork=0 Then
      IsOnline = True
   Else
      IsOnline = False
   End If
   
   objRS.Close
   Set objRS = Nothing
End Function
%
(省略部分)
<%
if Request.Form("action")="true" then
   username=trim(Request.Form("username"))      '登录用户名
  password=trim(Request.Form("password"))      '登录密码
  otherpwd = Trim(Request.form("otherpwd"))    '附加码
  reotherpwd = Trim(Request.form("reotherpwd"))'生成的附加码
  
  legalTag=checkenter()

  If legalTag=TRUE then '如果没有非法输入,则进行用户验证
    if otherpwd = reotherpwd then  '附加码比较
      legalUserTag=checksysUser()  '系统用户验证 
      if legalUserTag=true then
         If Session("level")=1 and Session("admin")="True"  Then
            Response.Redirect("manage.asp")
            Response.End
         End If        
        If Session("level")=2  Then
        Response.Redirect("main.asp")
        Response.End
        End If
        If Session("level")=3  Then 
        logtoncount=IsOnline(user)
        If logtoncount=True Then
         set rs=server.createobject("adodb.recordset")
         insertsql="select * from kaoqing_table"
         rs.open insertsql,db,1,3
         rs.addnew
         rs("user")=username
         rs("recordYear")=Year(Now())
         rs("recordMonth")=Month(Now())
         rs("recordDay")=Day(Now())
         rs("recordTime")=Time
         rs("Iswork")=1
         rs("note")=note 
  
         rs.update
    
         rs.close
        set rs=nothing
       Response.Redirect("normal.asp")
        else
        Response.Write"你已登录!"
        End If
         Response.End
         End If

         else
        errmsg="<font color=#FF0000><b>用户名或者用户密码错误,请重新输入!</b></font>"
      end if
    else
      errmsg="<font color=#FF0000><b>附加码输入错误,请重新输入!</b></font>"
    end if
  else
    errmsg="<font color=#FF0000><b>用户名输入有误,请重新输入!</b></font>"
  end if
end if 
%>

回复列表 (共3个回复)

沙发

Set objRS = Session("objRS")
直接
objRS = Session("objRS")
就可以了

板凳


谢谢楼上的,我试了试还是不行.请再给我指点一下好吗?

3 楼

mysql ="SELECT * FROM kaoqing_table WHERE user='"&username&"' and recordYear="&Year(Now())&" and recordMonth="&Month(Now())&" and recordDay="&Day(Now())&""
   Set objRS = Session("objRS")
   objRS.Source = mysql
   objRS.Open
你这里想做什么?
如果赋值,直接objRS = Session("objRS")就可以了
如果要执行sql语句,就改成set objRS = conn.execute(mysql)
没有看懂你想要做什么

我来回复

您尚未登录,请登录后再回复。点此登录或注册