asp缺少对象的错误
<%id=Request.Form("userid")pwd=Request.Form("userpwd")setconn=Server.CreateObject("AD...
<%
id=Request.Form("userid")
pwd=Request.Form("userpwd")
set conn=Server.CreateObject("ADODB.Connection")
conn.Open("driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("userinfo.mdb"))
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * FROM user WHERE 用户名='" & id & "' and 密码=' " & pwd & "'"
rs.Open sql,conn,1,3
if Recordset.EOF then Response.Redirct("loginfail.asp")
Response.Redirct("user.asp")
%>
运行后错误如下
Microsoft VBScript 运行时错误 错误 '800a01a8'
缺少对象: 'Recordset'
/login.asp,行 9
请帮忙看下谢谢 展开
id=Request.Form("userid")
pwd=Request.Form("userpwd")
set conn=Server.CreateObject("ADODB.Connection")
conn.Open("driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("userinfo.mdb"))
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * FROM user WHERE 用户名='" & id & "' and 密码=' " & pwd & "'"
rs.Open sql,conn,1,3
if Recordset.EOF then Response.Redirct("loginfail.asp")
Response.Redirct("user.asp")
%>
运行后错误如下
Microsoft VBScript 运行时错误 错误 '800a01a8'
缺少对象: 'Recordset'
/login.asp,行 9
请帮忙看下谢谢 展开
展开全部
自己调试下:
<%
set conn=Server.CreateObject("ADODB.Connection")
connString="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("test.mdb")
conn.Open connString
//sql="select * from [login]"
sql="select * from login where name='"&request.Form("userid")&"' and password='"&request.Form("userpassword")&"'"
set rs=conn.execute(sql)
response.write(rs("name"))
response.write(" ")
response.write(rs("password"))
conn.Close()
%>
<%
if rs.bof and rs.eof then '数据库中无记录'
response.write "<b>用户名或密码不正确!</b>"&" <a href='user.asp'><b>返回</b></a>"
else
Session("userid")=userid
Session("userpassword")=userpassword
response.redirect "http://www.baidu.com"
end if
conn.close
%>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="abc" action="test.asp">
帐号<input type="text"id="userid" value="abc"/>
密码<input type="password" value="123" id="userpassword" value="123" />
<input type="submit" />
</form>
</body>
</html>
<%
set conn=Server.CreateObject("ADODB.Connection")
connString="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("test.mdb")
conn.Open connString
//sql="select * from [login]"
sql="select * from login where name='"&request.Form("userid")&"' and password='"&request.Form("userpassword")&"'"
set rs=conn.execute(sql)
response.write(rs("name"))
response.write(" ")
response.write(rs("password"))
conn.Close()
%>
<%
if rs.bof and rs.eof then '数据库中无记录'
response.write "<b>用户名或密码不正确!</b>"&" <a href='user.asp'><b>返回</b></a>"
else
Session("userid")=userid
Session("userpassword")=userpassword
response.redirect "http://www.baidu.com"
end if
conn.close
%>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="abc" action="test.asp">
帐号<input type="text"id="userid" value="abc"/>
密码<input type="password" value="123" id="userpassword" value="123" />
<input type="submit" />
</form>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
if Recordset.EOF then Response.Redirct("loginfail.asp")
这句改为
if rs.bof and rs.eof then Response.redirct("loginfail.asp")
这句改为
if rs.bof and rs.eof then Response.redirct("loginfail.asp")
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你的数据库有值吗?
或者你的字段搞错了
或者你的字段搞错了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询