<%
sqlstr="SELECT * from user where username='"&request("username")&"' "
set myrs=server.CreateObject("Adodb.recordset")
myrs.Open sqlstr,conn,1,3
'上面是查询下数据库中是否有这个用户
if rs.eof then '如果没有则添加该用户.
rs.addnew
rs("username")=request("username")
rs("password")=request("password")
rs.update
else '如果有则提示帐号重复.
response.write("<script>alert('帐号重复!');window.close()</script>")
end if
%>
各位,我是这样放的,帮看看怎样改呀?
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<form name="form1">
<p>
<input name="xx" type="text" id="xx">
<%
sqlstr="SELECT * from zhuce where use='"&request("xx")&"' "
set myrs=server.CreateObject("Adodb.recordset")
myrs.Open sqlstr,conn,1,3
if rs.eof then
rs.addnew
rs("use")=request("xx")
rs("pw")=request("pw")
rs.update
else
response.write("<script>alert('帐号重复!');window.close()</script>")
end if
%>
</p>
<p>
<input name="pw" type="text" id="pw">
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form>
</body>
</html>
我试了各位的方法了,不知道错在那里,可以帮改一下嘛??
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<form name="form1">
<p>
<input name="xx" type="text" id="xx">
<%
sqlstr="SELECT * from zhuce where use='"&request("xx")&"' "
set myrs=server.CreateObject("Adodb.recordset")
myrs.Open sqlstr,conn,1,3
if rs.eof then
rs.addnew
rs("use")=request("xx")
rs("pw")=request("pw")
rs.update
else
response.write("<script>alert('帐号重复!');window.close()</script>")
end if
%>
</p>
<p>
<input name="pw" type="text" id="pw">
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form>
</body>
</html>