我的ASP文件运行时出现了Microsoft VBScript 编译器错误 '800a0400' 缺少语句 \admin_student.asp, line 1
Microsoft VBScript 编译器错误 '800a0400' 缺少语句
\admin_student.asp, line 131
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
option explicit
Response.expires=-1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","no-store"
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>考生档案管理</title>
<link href="admin.css" rel="stylesheet" type="text/css">
<style>
body {
font-size:12px;
}
</style>
</head>
<body>
<table width="90%" align="center" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF"
class="tborder">
<tr class="tdtbg">
<td align="center">
考 生 管 理
</td>
</tr>
<tr class="tdbg">
<td>
<a href="admin_student.asp">考生管理首页</a> | <a
href="admin_student.asp?action=add">添加考生</a>
</td>
</tr>
</table>
<br>
<%
dim strAction
if checkAdminLogin() = false then '进行管理员登录验证
respinse.redirect "admin_login.asp"
end if
if checkPurview(CONST_PURVIEW_STUDENT) = false then
response.write "<center><font size=4>你没有进行此操作的权限," & "请与系统管理员联系!
</font></center>"
response.write "</body></html>"
response.end
end if
strAction = trim(request.querystring("action"))
if strAction = "" then
strAction = trim(request.querystring("action"))
end if
select case strAction
case "del"
call del() '删除考生
case "modify"
call modify() '修改考生界面
case "savemodify"
call saveModify() '保存修改结果
case "add"
call add() '添加考生界面
case "saveadd"
call saveAdd() '保存添加结果
case "checkup"
call checkup() '审批考生
case "checkupcancel"
call checkupcancel() '取消审批
case else
call main() '主界面
end select
call closeConn()
%>
</body>
</html>
<%
sub main() '主界面
'定义:Recordset对象,SQL字串,当前页号,最大页号,总学生数
'每页显示学生数,当前在本页第几条记录
dim rsStudent,strSqlStudent,intCurPage,intMaxPage
dim intTotalStudent,intStudentPerPage,intCurRec,I
intStudentPerPage = 24 '设定每页24个考生
if IsNumeric(Trim(request.querystring("page"))) = true then
intCurPage = CLng(request.querystring("page"))
else
intCurPage = 1
end if
%>
<table width="90%" align="center" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF"
class="tborder">
<tr class="tdtbg">
<td width="80" align="center"> 考 生 ID</td>
<td align="center"> 登录名称 </td>
<td width="100" align="center"> 真实姓名 </td>
<td width="50" align="center"> 性 别 </td>
<td width="100" align="center"> 状 态 </td>
<td width="150" align="center"> 操 作 </td>
</tr>
<%
set rsStudent =server.createobject("ADODB.Recordset")
strSqlStudent = "select * from student"
rsStudent.open strSqlStudent,G_CONN,1,1
if rsStudent.bof and rsStudent.eof then
response.write "<tr class='tdbg'><td colspan='6' align='center'>没有考生</td></tr>"
end if
rsStudent.pagesize = intStudentPerPage
intMaxPage = rsStudent.pagecount
if intCurPage > rsStudent.pagecount then
intCurpage = rsStudent.pagecount
elseif intCurPage < 1 then
intCurPage = 1
end if
if rsStudent.pagecount > 0 then
rsStudent.absolutepage = intCurPage
end if
intCurRec = 1
while not rsStudent.eof and intCurPage <= intStudentPerPage
response.write "<tr class='tdbg'>"
response.write "<td align='center'>" & rsStudent("studentid") & "</td>"
response.write "<td align='center'>" & rsStudent("username") & "</td>"
response.write "<td align='center'>" & rsStudent("studentname") & "</td>"
if rsStudent("sex") = true then
response.write "<td align='center'>男</td>"
else
response.write "<td align='center'>女</td>"
end if
if rsStudent("studenttype") = 0 then
response.write "<td align='center'><font color='#ff5500'> 未 审 批</font></td>"
else
response.write "<td align='center'><font color='#229922'> 已 注 册</font></td>"
end if
response.write "<td align='center'>"
response.write "<a href='#' onClick=""if (confirm('删除考生将连同考试记录一起删除," &"你确认
吗?') == true) window.open('admin_student.asp?action=del&studentid="
& rsStudent("studentid") & "&page=" & intCurPage & "','_self')"">删除</a> | "
response.write "<a href='admin_student.asp?action=modify&studentid="
& rsStudent("studentid") & "&page=" & intCurPage & "'>修改</a> "
if rsStudent("studenttype") = 0 then
response.write "| <a href='admin_student.asp?action=checkup&studentid="
& rsStudent("studentid") & "&page=" & intCurPage & "'>审批</a> "
end if
response.write "</td></tr>"
rsStudent.movenext
intCurRec = intCurRec + 1
wend
rsStudent.close
set rsStudent = nothing
%>
</table>
<center>
<%
'显示页面控制项目
call showPageCtrl(intMaxPage,intCurPage,"admin_student.asp?page=")
%>
</center>
<%
end sub
%>
<form action="admin_student.asp" method="post">
<input name="action" type="hidden" value="saveadd">
<table width="90%" align="center" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF"
class="tborder">
<tr class="tdtbg">
<td colspan="2" align="center"> 添 加 考 生 </td>
</tr>
<tr class="tdbg">
<td width="180" align="right">登录名称:</td>
<td>
<input name="username" type="text" class="text" size="20"
maxlength="25" value="">
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right">登录密码:</td>
<td>
<input name="studentpwd" type="password" class="text" size="20"
maxlength="50" value="">
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right">确认密码:</td>
<td>
<input name="confirmpwd" type="password" class="text" size="20"
maxlength="50" value="">
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right">真实姓名:</td>
<td>
<input name="studentname" type="text" class="text" size="20"
maxlength="50" value="">
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right"> 性 别:</td>
<td>
<input name="sex" type="radio" checked value="1">男
<input name="sex" type="radio" value="0">女
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right">出生日期:</td>
<td>
<input name="birthday" type="text" class="text" size="20"
maxlength="25" value="">例:1988-12-11
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right">电话号码:</td>
<td>
<input name="tel" type="text" class="text" size="20" maxlength="50"
value="">
</td>
</tr>
<tr class="tdbg">
<td width="180" align="right">电子邮件:</td>
<td>
<input name="email" type="text" class="text" size="30"
maxlength="128" value="">
</td>
</tr>
<tr class="tdbg">
<td align="center" colspan="2">
<input type="submit" value=" 添 加 ">
</td>
</tr>
</table>
</form>
<%
sub saveAdd()
dim rsStudent,strSqlStudent,strUserName,strStudentName,strStudentPwd,strTel
dim blnSex,strEmail,dtmBirthday,strErr
strErr = ""
'取得提交的信息并检查其合理性
strUserName = trim(request.form("username"))
strStudentName = trim(request.form("studentname"))
strStudentPwd = trim(request.form("studentpwd"))
strTel = trim(request.form("tel"))
strEmail = trim(request.form("email"))
if CLng(trim(request.form("sex"))) > 0 then
blnSex = true
else
blnSex = false
end if
if strUserName = "" then
strErr = "<li>登录名为空!</li>"
end if
if strStudentPwd = "" then
strErr = strErr & "<li>密码为空!</li>"
end if
if strStudentPwd <> trim(request.form("confirmpwd")) then
strErr = strErr & "<li>密码与确认密码不对!</li>"
end if
if strStudentName = "" then
strErr =strErr & "<li>真实姓名为空!</li>"
end if
if IsDate(trim(request.form("birthday"))) = false then
strErr = strErr & "<li>日期格式不正确!</li>"
else
dtmBirthday = CDate(trim(request.form("birthday")))
end if
if G_CONN.execute("select count(*) as reccount from student where studentname='"&
strStudentName & "'")("reccount") > 0 then
strErr = strErr & "<li>系统中已存在此登录名!</li>"
end if
if strErr <> "" then
showErrMsg(strErr)
exit sub
end if
'保存学生档案到数据库中
set rsStudent = server.createobject("ADODB.Recordset")
strSqlStudent = "select * from student where studentid=0"
rsStudent.Open strSqlStudent,G_CONN,1,3
rsStudent.addnew
rsStudent("username") = strUserName
rsStudent("studentpwd") = strStudentPwd
rsStudent("studentname") = strStudentName
rsStudent("birthday") = dtmBirthday
rsStudent("tel") = strTel
rsStudent("email") = strEmail
rsStudent("sex") = blnSex
rsStudent("studenttype") = 1
rsStudent.update
rsStudent.close
set rsStudent = nothing
call closeConn()
response.redirect "admin_student.asp"
end sub
%>
<%
sub modify() '修改考生界面
dim rsStudent,strSqlStudent,intStudentID,strStudentName,strTel,strEmail
dim blnSex,dtmBirthday,trErr
strErr =""
intStudentID = CLng(trim(request.querystrint("studentid")))
'取得要修改考生的信息
strSqlStudent = "select * from student where studentid=" & intStudentID
set rsStudent = server.createobject("ADODB.Recordset")
rsStudent.open strSqlStudent,G_CONN,1,1
if rsStudent.bof and rsStudent.eof then
strErr = "<li>此考生不存在!</li>"
end if
if strErr <> "" then
rsStudent.close
set rsStudent = nothing
showErrMsg(strErr)
exit sub
end if
%>
<form action="admin_student.asp" method="post">
<input name="action" type="hidden" value="savemodify">
<input name="studentid" type="hidden" value="<%=intStudentID%>">
<table width="90%" align="center" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF"
class="tborder">
<tr class="tdtbg">
<td colspan="2" align="center"> 修 改 考 生 </td>
</tr>
<tr class="tdbg">
<td width="200" align="right">登录名称:</td>
<td>
<font color="#0000FF"><%=rsStudent("username")%></font>
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right">(留空不修改)登录密码:</td>
<td>
<input name="studentpwd" type="password" class="text" size="20"
maxlength="50" value="">
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right">(留空不修改)确认密码:</td>
<td>
<input name="confirmpwd" type="password" class="text" size="20"
maxlength="50" value="">
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right">真实姓名:</td>
<td>
<input name="studentname" type="text" class="text" size="20"
maxlength="50" value="<%=rsStudent("studentname")%>">
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right"> 性 别:</td>
<td>
<input name="sex"
<%if rsStudent("sex")=1 then Response.Write "checked"%>
type="radio" value="1">男
<input name="sex"
<%if rsStudent("sex")=0 then Response.Write "checked"%>
type="radio" value="0">女
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right">出生日期</td>
<td>
<input name="birthday" type="text" class="text" size="20"
maxlength="25" value="<%= rsStudent("birthday")%>">
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right">电话号码:</td>
<td>
<input name="tel" type="text" class="text" size="20" maxlength="50"
value="<%=rsStudent("tel")%>">
</td>
</tr>
<tr class="tdbg">
<td width="200" align="right">电子邮件:</td>
<td>
<input name="email" type="text" class="text" size="30"
maxlength="128" value="<%=rsStudent("email")%>">
</td>
</tr>
<tr class="tdbg">
<td colspan="2" align="center">
<input type="submit" value=" 修 改
">
<input type="reset" value=" 重 写 ">
</td>
</tr>
</table>
</form>
<%
sub saveModify() '保存修改结果
dim rsStudent,strSqlStudent,intStudentID,strUserName,strStudentName
dim strStudentPwd,blnSex,dtmBirthday,strEmail,strTel,strErr
strErr = ""
'取得提交的信息并检查其合理性
intStudentID = CLng(Trim(request.from("studentid")))
strStudentName = Trim(request.form("studentname"))
strEmail = Trim(request.form("email"))
strTel =Trim(request.form("tel"))
if CLng(trim(request.form("sex"))) > 0 then
blnSex = true
else
blnSex = false
end if
if strStudentName = "" then
strErr = strErr & "<li>出生日期格式错误!</li>"
else
dtmBirthday = CDate(trim(request.form("birthday")))
end if
if strErr <> "" then
showErrMsg(strErr)
exit sub
end if
'保存考生信息
set rsStudent = server.createobject("ADODB.Recordset")
strSqlStudent = "select * from student where studentid=" & intStudentID
reStudent.open strSqlStudent,G_CONN,1,3
if rsStudent.bof and rsStudent.eof then
strErr = "<li>要修改的考生不存在!</li>"
end if
if strErr <> "" then
rsStudent.close
set rsStudent = nothing
showErrMsg(strErr)
exit sub
end if
rsStudent("studentname") = strStudentName
if strStudentPwd <> "" then
rsStudent("studentpwd") = strStudentPwd
end if
rsStudent("sex") = blnSex
rsStudent("email") = strEmail
rsStudent("tel") = strTel
rsStudent("birthday") = dtmBirthday
reStudent.update
reStudent.close
set reStudent = nothing
call closeConn()
response.redirect "admin_student.asp"
end sub
%>
<%
sub checkup() '审批考生
dim intStudentID,strErr
intStudentID = CLng(Trim(request.querystrint("studentid")))
if G_CONN.execute("select count(*) as recount from student where studentid =" &
intStudentID)("reccount") = 0 then
strErr = "<li>此考生不存在!</li>"
end if
if strErr <> "" then
showErrMsg(strErr)
exit sub
end if
G_CONN.execute("update student set studenttype=1")
call closeConn()
response.redirect "admin_student.asp"
end sub
%>
<%
sub del() '删除考生
dim intStudentID,strErr
strErr = ""
intStudentID = CLng(Trim(request.querystrint("studentid")))
'当考生正在进行考试时是不能删除考生的
if G_CONN.execute("select count(*) as reccount from prj_student where state=2 "and
studentid=" & intStudentID)("reccount") > 0 then
strErr = "<li>此考生正在考试,不能被删除!</li>"
end if
if strErr <> "" then
showErrMsg(strErr)
exit sub
end if
'使用事务来删除多个表的相关内容
G_CONN.begintrans
G_CONN.execute "delete from prj_process where studentid=" & intStudentID
G_CONN.execute "delete from prj_student where studentid=" & intStudentID
G_CONN.execute "delete from student where studentid=" & intStudentID
G_
call closeConn()
response.redirect "admin_student.asp"
exit sub
%>