各位大哥帮我看看这段代码

来源:百度知道 编辑:UC知道 时间:2024/05/24 10:19:07
username=trim(Request("username"))

if FoundErr<>True then
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * from user where username='"&username&"'",conn,1,3
if not (rs.bof and rs.EOF) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>数据库中已经存在此管理员!</li>"
else
password=md5(password)
sql="insert into [user] (username,mima) values('"&username&"','"&password&"')"
conn.execute(sql)
set rs=Nothing
Call CloseConn()
response.Redirect "index.asp"
end if
end if
每次都是提示“数据库中已经存在此管理员!”

你好,可以加你的QQ吗?我把你给我的代码用了上去,还是不行!!!
数据库中总是添加同样的记录!
我的QQ:63922806

if not (rs.bof and rs.EOF) then 应该有问题

username=trim(Request("username"))

if FoundErr<>True then
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * from user where username='"&username&"'",conn,1,3

if rs.bof or rs.EOF then
password=md5(password)
sql="insert into [user] (username,mima) values('"&username&"','"&password&"')"
conn.execute(sql)
set rs=Nothing
Call CloseConn()
response.Redirect "index.asp"
else
FoundErr=True
ErrMsg=ErrMsg & "<br><li>数据库中已经存在此管理员!</li>"
end if
end if