asp数据库查询判断语句

来源:百度知道 编辑:UC知道 时间:2024/05/11 03:26:13
<% dim admin_name,admin_pwd,rs
admin_name=trim(request("name"))
admin_pwd=trim(request("pwd"))
set rs=server.createobject("adodb.connection")
sql="select * from user where user='"&admin_name&"'and password='"&admin_pwd&"'"
rs.Open sql,conn,1,1
<%if isnull(rs(user))=false then
Response.redirect(index1.htm)
else
response.write "非法登陆"
rs.close
end if
%>
说上面那个判断语句缺少语句
怎么回事
当把哪个语句换成if not rs.eof then
说什么Microsoft VBScript 编译器错误 错误 '0x800a0400' 缺少语句
到底缺少什么语句?

if isnull(rs(user))=false then
这句中user应该加双引号
if isnull(rs("user"))=false then

还有
Response.redirect(index1.htm)
这句的index1.htm是不是也要加双引号?
Response.redirect "index1.htm"

<%if isnull(rs("user"))=false then
Response.redirect("index1.htm")
else
response.write "非法登陆"
rs.close
end if
%>

rs.Open sql,conn,1,1
<%if isnull(rs(user))=false then

改成

rs.Open sql,conn
if not rs.eof then