ADODB.Connection (0x800A0E78)
对象关闭时,不允许操作。
/sims/web/admlogin.asp, 第 37 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022) 网页:
POST 71 ??? /sims/web/admlogin.aspPOST Data:
username=2000&password=00000000000000&validate=2550&Submit=%B5%C7%C2%BC 时间:
2010年12月20日, 12:56:26 
详细信息:
Microsoft 支持 程序代码如下:<!--#include file="conn.asp" -->
<!--#include file="char.asp"-->
<!--#include file="inpour.asp"-->
<!--#include file="md5.asp"-->
      <%'判断个人用户的session值
If session("logOk") = True Then
    response.Redirect("main.asp")
Else
    session("logOk") = False
End IfDim rs, sql, action
Dim username, password, validateaction = Trim(request.QueryString("action"))
Select Case action
    Case "checkLoginUser"
        Call checkLoginUser()
    Case ""
        Call showLoginForm()
End SelectFunction checkLoginUser() '检验用户帐户密码
    username = Trim(request.Form("username"))
    password = md5(Trim(request.Form("password")))
    validate = Trim(request.Form("validate")) '接受验证码
    If (validate <> session("GetCode")) Then
        response.Write "<script>alert('验证码错误!');window.location.href='admlogin.asp';</script>"
        Exit Function
    End If    username = Checkstr(username)
    password = Checkstr(password)    '从数据库教师信息表中查询用户名和密码
    sql = "SELECT * FROM [user] WHERE [username]='"&username&"' AND [password]='"&password&"'"
    Set rs = conn.Execute(sql)
    If Not rs.EOF Then '验证成功后设置session,并且转到相应的页面
        session("logOk") = True
        session("userid") = rs("userid")
        session("username") = username
        session("realname") = rs("realname")
        userid = rs("userid")
        rs.Close
        Set rs = Nothing
        conn.Close
        Set conn = Nothing
        response.Redirect("main.asp")
    Else
        response.Write("您输入的帐户不存在或密码不正确,请<a href='javascript:history.go(-1)'>重新登陆</a>")
        session("logOk") = False
    End If
    conn.Close
End FunctionFunction showLoginForm() '显示登录界面,当帐户或密码为空的时候弹出提示框。%>
      <script language="JavaScript" type="text/JavaScript">
function checkForm(theForm){
if(theForm.username.value==""){alert(" 用户名称不能为空!");theForm.username.focus();return false;}
if(theForm.password.value==""){alert(" 用户密码不能为空!");theForm.password.focus();return false;}
if(theForm.validate.value==""){alert(" 验证码不能为空!");theForm.validate.focus();return false;}
return true;
}
</script>
<link href="sty.css" rel="stylesheet" type="text/css" />

      <form id="form1" name="form1" method="post" action="?action=checkLoginUser">
        <table width="400" border="0" align="center" cellpadding="1" cellspacing="5" bgcolor="#E2F4FC">
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td width="107" align="right"><font color="#000000">登录帐户:</font></td>
            <td><input name="username" type="text" id="username" size="20" onMouseOver="this.style.background='#3CB5EC'" onMouseOut="this.style.background='#FFFFFF'"/></td>
          </tr>
          <tr>
            <td align="right"><font color="#000000">用户密码:</font></td>
            <td><input name="password" type="password" id="password" size="20" onMouseOver="this.style.background='#3CB5EC'" onMouseOut="this.style.background='#FFFFFF'" /></td>
          </tr>
          <tr>
            <td align="right"><font color="#000000">验 证 码:</font></td>
            <td><input name="validate" type="text" id="validate" size="10" onMouseOver="this.style.background='#3CB5EC'" onMouseOut="this.style.background='#FFFFFF'"/>
              <a href="admlogin.asp"><img src="num.asp?id=<%=rnd%>" alt="点击刷新图片" height="13" border="0" /></a></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit" value="登录"onclick="return checkForm(this.form)"/>
              &nbsp;
              <input type="reset" name="Submit2" value="取消" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td align="right">&nbsp;</td>
          </tr>
        </table>
      </form>
      <%
End Function%>

解决方案 »

  1.   

    请检查con数据库连接是否未打开。
      

  2.   



      Else
      response.Write("您输入的帐户不存在....")
      session("logOk") = False
      End If
      conn.Close改为  Else
      response.Write("您输入的帐户不存在....")
      session("logOk") = False
      conn.Close
      End If
      

  3.   


      Else
      response.Write("您输入的帐户不存在....")
      session("logOk") = False
      End If
      conn.Close改为  Else
      response.Write("您输入的帐户不存在....")
      session("logOk") = False
      conn.Close
      End If
      

  4.   

    Set rs = conn.Execute(sql)
    改为set Rs=server.CreateObject("adodb.recordset")
      rs.open sql,conn,1,1
      

  5.   

    下面是连接数据库的程序也请各位看看:
    <%
    Dim conn, ConnStr
    db = "data/stuinfodata.mdb"
    '设置连接数据库方式:数据库驱动、连接服务器、用户名、密码、数据库名'
    ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) '连接Access数据库'
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.provider="sqloledb" If Err Then
        Err.Clear
        Set conn = Nothing
        Response.Write "数据连接错误!"
        Response.End()
    End If
    %>