看下这段代码有没有错误

来源:百度知道 编辑:UC知道 时间:2024/05/28 21:14:56
下面这段代码似乎数据库是连接上的,但是无法登陆,显示的是用户名或密码错误,应该是session("admin")="",但是这段session代码我也不是很熟悉,希望个为大虾看 看
set rslogin=conn.execute("select * from admin where adminname='"&Trim(Request.Form("adminname"))&"' and adminpwd='"&md5(Trim(Request.Form("adminpwd")))&"'")
if rslogin.eof and rslogin.bof then
session("admin")=""
Response.Write("<script language=""javascript"">")
Response.Write("alert(""用户名或密码错误!"");")
Response.Write("top.location='login.asp'")
Response.Write("</script>")
Else
'Call admin_log()
session("admin")="true"
Response.Write("<script language=""javascript"">")
Response.Write("top.location='index.asp'")
Response

set rslogin=conn.execute("select * from admin where adminname='"&Trim(Request.Form("adminname"))&"' and adminpwd='"&md5(Trim(Request.Form("adminpwd")))&"'
改成
set rslogin=server.createobject("adodb.recordset")
sql="select * from admin where adminname='"&Trim(Request.Form("adminname"))&"' and adminpwd='"&md5(Trim(Request.Form("adminpwd")))&"'"
rslogin.open sql,conn,1,3
试试