asp 简单代码的错误

来源:百度知道 编辑:UC知道 时间:2024/06/01 10:29:52
<%
dim username,pwd
username=request.Form("username")
pwd=request.Form("password")

%>
<%
sql="select * from userinfo where username="&username&"and password="&pwd&" "
set userinfo=server.CreateObject("ADODB.recordset")
userinfo.open sql,conn,1,1
%>
<% if not userinfo.eof then
response.Redirect("logined.asp")%>

<% else %>
你的账号或者密码不正确
<% end if%>
<% userinfo.close
set userinfo=nothing
%>

这段代码有什么问题
非常的感谢各位给我的帮助,晚上我发现这个代码确实没错 只是自己有点粗心 把conn。asp没放进inc里面 呵呵 因为自己的粗心麻烦大家了

sql="select * from userinfo where username='"&username&"'and password='"&pwd&"'"

加单引号

就这么看好象没有错误,你的错误提示是什么?

另外弄那么多<%%>做什么?为什么不放在一起?

sql="select * from userinfo where username='"&username&"'and password='"&pwd&"'"