www.gusucode.com > asp+ACCESS在线考试系统(源代码+论文+外文翻译) > asp+ACCESS在线考试系统(源代码+论文+外文翻译)\register.asp
<%@ Language=VBScript %> <% option explicit %> <!--#include file="conn.asp"--> <% dim id,studentname,studentpassword'定义变量 dim sql,rs,rsc if request("submit")="注册" then '添加新用户 if trim(request("studentname"))="" or trim(request("studentpassword"))="" then response.write "错误!用户名或密码不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>" response.end end if set rs=server.createobject("adodb.recordset") '检查学生是否重名 rs.open "select * from student where studentname='" & cstr(trim(request("studentname"))) & "'",conn,1,1 if err.number <> 0 then response.write "数据库出错" else if not rs.bof and not rs.eof then response.write "错误!该用学生存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>" response.end end if end if rs.close set rs=nothing sql="insert into student(studentname,studentpassword) values('" & cstr(trim(request("studentname"))) & "','" & cstr(trim(request("studentpassword"))) & "')" conn.execute sql if err.number <> 0 then response.write "数据库操作出错:" + err.description else %> <script language=vbscript> msgbox "操作成功!新用户<%=trim(request("studentname"))%>的注册信息添加成功!" </script> <%end if end if %> <html> <head> <title>新用户注册</title> </head> <body background=../images/backimage.gif > <p align="center"> <font size=3>新用户注册</font><br> <form action="register.asp" method="post"> 用户名称:<input type="text" name="studentname" class=input maxlength=14 size="16"><br> 用户密码:<input type="password" name="studentpassword" class=input maxlength=12 size="16"><br> <input type=submit name="submit" value="注册" class=button> </form> <p align=center><a href="default.asp"><font color=red size=+0 face=楷体>返回在线考试系统登录界面</font></a></p> </p> </body> </html>