考试页面只有15名考生,无法添加,求解。如果有愿意的大神,可以帮我修改一下,谢谢
<%@LANGUAGE="VBScript" CODEPAGE="936"%><%option explicit%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
Response.expires=-1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","no-store"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<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 '进行管理员登录验证
response.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.form("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,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 top 15 * 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 intCurRec <= 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
sub add() '添加学员界面
%>
<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>
<%
end sub
sub saveAdd() '保存添加结果
dim rsStudent,strSqlStudent,strUserName,strStudentName,strStudentPwd,strTel,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,blnSex,dtmBirthday,strErr
strErr = ""
intStudentID = CLng(trim(request.querystring("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="<%=rsStudent("studentid")%>">
<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") = true then
response.write "checked"
end if
%>
type="radio" value="1">男
<input name="sex"
<%
if rsStudent("sex") = false then
response.write "checked"
end if
%>
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="<%=FormatDatetime(rsStudent("birthday"),2)%>">
</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>
<%
rsStudent.close
set rsStudent = nothing
end sub
sub saveModify() '保存修改结果
dim rsStudent,strSqlStudent,intStudentID,strUserName,strStudentName,strStudentPwd,blnSex,dtmBirthday,strEmail,strTel,strErr
strErr = ""
intStudentID = CLng(Trim(request.form("studentid")))
strStudentName = Trim(request.form("studentname"))
strStudentPwd = Trim(request.form("studentpwd"))
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>"
end if
if strStudentPwd <> Trim(request.form("confirmpwd")) 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 strErr <> "" then
showErrMsg(strErr)
exit sub
end if
set rsStudent = server.createobject("ADODB.Recordset")
strSqlStudent = "select * from student where studentid=" & intStudentID
rsStudent.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
rsStudent.update
rsStudent.close
set rsStudent = nothing
call closeConn()
response.redirect "admin_student.asp"
end sub
sub checkup() '审批考生
dim intStudentID,strErr
intStudentID = CLng(Trim(request.querystring("studentid")))
if G_CONN.execute("select count(*) as reccount from student where studentid=" & intStudentID)("reccount") = 0 then
strErr = "<li>此考生不存在!</li>"
end if
if strErr <> "" then
sthowErrMsg(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.querystring("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"
end sub
%>