帮忙看一下这段asp代码错在那里
<!--#include file="conn.asp"-->
<%
if request("action")="reg" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where name='"&trim(request("name"))&"'",conn,1,1
if rs.recordcount>0 then
response.write "<Script language='JavaScript'>window.alert('您输入的用户名已存在,请返回重新输入!');history.back(-1);</Script>"
response.End()
end if
if request("action")="reg" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where 易做图='"&trim(request("易做图"))&"'",conn,1,1
if rs.recordcount>0 then
response.write "<Script language='JavaScript'>window.alert('您输入的域名已存在,请返回重新输入!');history.back(-1);</Script>"
response.End()
end if
sql="select * from user"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("names")=trim(request.Form("name"))
rs("pwd")=trim(request.Form("pwd"))
rs("wenti")=trim(request.Form("wenti"))
rs("易做图")=trim(request.Form("易做图"))
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript> alert('注册成功,点击确定立即登录!');location.replace('login.asp');</script>"
response.end
End if
end if
%>
答案:以前的代码杂乱无章,我帮你重新写了下。
试一下看看,如果不行就联系我。
<!--#include file="conn.asp"-->
<%
if request("action")="reg" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where name='"&trim(request("name"))&"'",conn,1,1
if rs.eof or rs.bof then
rs.close
rs.open "select * from user where 易做图='"&trim(request("易做图"))&"' and name<>'"&trim(request("name"))&"'",conn,1,3
if rs.eof or rs.bof then
rs.addnew
rs("names")=trim(request.Form("name"))
rs("pwd")=trim(request.Form("pwd"))
rs("wenti")=trim(request.Form("wenti"))
rs("易做图")=trim(request.Form("易做图"))
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('注册成功,点击确定立即登录!');location='login.asp';</script>"
else
rs.close
response.write "<Script language='JavaScript'>alert('您输入的域名已存在,请返回重新输入!');history.go(-1);</Script>"
end if
else
rs.close
response.write "<Script language='JavaScript'>alert('您输入的用户名已存在,请返回重新输入!');history.go(-1);</Script>"
end if
end if
%>
第三行起
if request("action")="reg" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where name='"&trim(request("name"))&"'",conn,1,1
if rs.recordcount>0 then
response.write "<Script language='JavaScript'>window.alert('您输入的用户名已存在,请返回重新输入!');history.back(-1);</Script>"
response.End()
end if
删除掉,,,重复啦
另外 最后一个 end if 删除
<!--#include file="conn.asp"-->
<%
if request("action")="reg" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where name='"&trim(request("name"))&"'",conn,1,1
if rs.recordcount>0 then
response.write "<Script language='JavaScript'>window.alert('您输入的用户名已存在,请返回重新输入!');history.back(-1);</Script>"
response.End()
end if
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where 易做图='"&trim(request("易做图"))&"'",conn,1,1
if rs.recordcount>0 then
response.write "<Script language='JavaScript'>window.alert('您输入的域名已存在,请返回重新输入!');history.back(-1);</Script>"
response.End()
end if
rs.close
set rs=nothing
sql="select * from user"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("names")=trim(request.Form("name"))
rs("pwd")=trim(request.Form("pwd"))
rs("wenti")=trim(request.Form("wenti"))
rs("易做图")=trim(request.Form("易做图"))
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript> alert('注册成功,点击确定立即登录!');location.replace('login.asp');</script>"
response.end
End if
%>
上一个:asp.net 连接access数据库出现insert into 语法错误
下一个:谁会ASP中的下载页面的代码?