📄 adduserok.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保存学生档案</title>
</head>
<body>
<%
dim struserno,strusername,struserzhuanye,strusersex,strusertime,strconn,connstr,strsql,rst
struserno=trim(request("userno"))
strusername=trim(request("username"))
struserzhuanye=trim(request("userzhuanye"))
strusersex=trim(request("usersex"))
strusertime=trim(request("usertime"))
if struserno="" then
response.write "<center><b><font size=2>学号不能为空!<a href=adduser.asp>返回重新添加</a></font></b></center>"
response.end
end if
if strusername="" then
response.write "<center><b><font size=2>姓名不能为空!<a href=adduser.asp>返回重新添加</a></font></b></center>"
response.end
end if
if struserzhuanye="" then
response.write "<center><b><font size=2>专业名不能为空!<a href=adduser.asp>返回重新添加</a></font></b></center>"
response.end
end if
'if strusersex="" then
'response.write "<center><b><font size=2>性别不能为空!<a href=adduser.asp>返回重新添加</a></font></b></center>"
'response.end
'end if
if strusertime="" then
response.write "<center><b><font size=2>入学时间不能为空!<a href=adduser.asp>返回重新添加</a></font></b></center>"
response.end
end if
set strconn=server.createobject("ADODB.CONNECTION")
connstr="DBQ="+server.mappath("bookstore.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
strconn.open connstr
set rst=server.createobject("adodb.recordset")
strsql="select * from userinfo where userno='"&struserno&"'"
rst.open strsql,strconn,1,1
if rst.recordcount>=1 then
response.write "<center><b><font size=2>错误提示:该信息已经存在!<a href=adduser.asp>返回</a>继续添加用户</font></b></center>"
response.end
else
set rst=server.createobject("adodb.recordset")
strsql="select * from userinfo where (userinfo.id is null)"
rst.open strsql,strconn,1,3
rst.addnew
rst("userno")=struserno
rst("userpassword")="1111"
rst("username")=strusername
rst("usersex")=strusersex
rst("userzhuanye")=struserzhuanye
rst("usertime")=strusertime
rst.update
response.write "<center><b><font size=2>恭喜您成功添加学生信息!<a href=adduser.asp>返回</a>继续添加用户</font></b></center>"
response.end
end if
rst.close
set rst=nothing
strconn.close
set strconn=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -