验证重复注册的问题

havy505 2006-02-10 09:29:51
username=trim(request("username"))
if username<>"" then
sql="select * from rsadmin where username="&username
'Response.Write sql
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if not rs.eof then
Response.Write ("<script>alert('管理员名已存在!');javascript:history.back(0)</script>")
else
conn.execute("insert into rsadmin([username],[password])values('"&username&"','"&password&"')")
conn.close
Response.Write ("<script>alert('管理员已添加!');window.location='admin_user.asp'</script>")
end if
response.end
end if

结果每次都是执行Response.Write ("<script>alert('管理员名已存在!');javascript:history.back(0)</script>")这段代码,本人是菜鸟,困惑中
...全文
125 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
havy505 2006-02-10
  • 打赏
  • 举报
回复
又是这位朋友,问题已解决
KimSoft 2006-02-10
  • 打赏
  • 举报
回复
这一句好象有问题吧
sql="select * from rsadmin where username="&username

改成

sql="select * from rsadmin where [username]='" & username & "'"

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧