高手帮我看看,哪里不完善,能把空的用户与密码添加成为一条记录
怎么改讲一下,加上注实
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("../date/ws.mdb")
%>
<%
If Trim(Request.Form("username"))="" or Trim(Request.Form("userpass"))="" Then
Response.Write("<script language=javascript>alert('请输入帐号和密码!');history.back(-1);</script>")
End If
set rs=Server.CreateObject("ADODB.Recordset")
sqlstr="select * from Admin Where username='" & Trim(Request.Form("username")) & "'"
rs.open sqlstr,conn,1,3
if not rs.eof then
Response.Write("<script language=javascript>alert('该管理员已经存在!');history.back(-1);</script>")
else
rs.AddNew
rs("username")=Trim(Request.Form("username"))
rs("userpass")=Trim(Request.Form("userpass"))
rs.Update
end if
response.write("<script>alert('添加成功');window.location.href='admin_list.asp';</script>")
response.end
%>