input_score.asp
来自「eayanQuery思燕大学成绩查询系统 版本 V1.6」· ASP 代码 · 共 229 行
ASP
229 行
<%option explicit%>
<!--#include file="Conn.asp"-->
<!--#include file="include/md5.asp"-->
<!--#include file="include/ReplaceHtml.asp"-->
<!--#include file="include/PublicFunction.asp"-->
<!--#include file="include/TeacherSession.asp"-->
<%' call CheckOuterUrl()
'强制浏览器重新访问服务器下载页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'***************************
Dim Action
Action=request.QueryString("Action")
Select Case Action
Case "Add_Score"
Call Add_Score()
Case "Edit_Score"
Call Edit_Score()
Case Else
Call Main(0)
End Select
Sub Main(Add_Or_Edit)
Dim Form_State 'Add_Or_Edit
'说明,0代表添加数据,1代表编辑现有数据
If Add_Or_Edit=0 then Form_State=0
If Add_Or_Edit=1 then
Form_State=1
Dim Edit_Teacher_sql,Edit_Teacher_rs
'Call OpenConn()
Edit_Teacher_sql="select [student_id],[student_no],[student_name],[stu_sex],[department_id],[teacher_id],[class_id] from [student] where student_id='"&request("teacher_id")&"'"
Set Edit_Teacher_rs=server.CreateObject("adodb.recordset")
Edit_Teacher_rs.open Edit_Teacher_sql,Initialize_Conn,1,3
End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>思燕Seayan成绩查询系统SQL版本v1.0----现代教学管理信息系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="gb2312">
<meta content="all" name="robots">
<meta content="websvc@163.com" name="author">
<meta content="版权所有:Seagreen 2005-2008" name="Copyright">
<meta content="思燕Seayan成绩查询系统SQL版本v1.0, 由 赵海 先生模仿方正教务管理系统开发。" name="description">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="stylesheet" rev="stylesheet" href="images/main.css" type="text/css" media="all">
<SCRIPT language="javascript" src="images/Menu.js"></SCRIPT>
<link href="images/my_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<script language="javascript">
function CheckMyForm()
{
if(theForm.teacher_name.value == '') {
alert('请输入学生的姓名!');
theForm.teacher_name.focus();
return false;
}
if (theForm.student_no.value == '')
{
alert("请输入学生的学号!");
theForm.student_no.focus();
return false;
}
if (theForm.class_id.value == '')
{
alert("数据不完整,无法提交数据!");
return false;
}
}
//-->
</script>
</head>
<body>
<iframe src="images/head.htm" frameborder="0" scrolling="no" width="100%" height="59"></iframe>
<div id="menu" STYLE='width:100%'><!--#include file="menu.asp"--></div>
<div id="welcome">
<span id="xhxm"><font color="red"> </font></span>
<table width="100%" height="707" border="0" cellpadding="0" cellspacing="0" background="axhucj/images/admin_MainBg.gif">
<tr>
<td width="3%" height="16"> </td>
<td colspan="2"> </td>
<td width="2%"> </td>
</tr>
<tr>
<td height="23"> </td>
<td align="left" colspan="2"><div align="center">当前班级是:<font color="red"><%=request("class_name")%></font>
当前学期是:<% call ShowCurrentTerm(0)'此处返回当前学期的名称 %> <font color="green">如果此处的信息有错误,请联系管理员: 13855170575</font>
<hr width="100%\"></div> </td>
<td> </td>
</tr>
<tr>
<td height="34" colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3%" height="28"> </td>
<td width="64%"><form name="InputScoreForm" method="post" action="ShowScoreInputForm.asp">请您选择待添加成绩的科目:
<input type="hidden" name="term_id" value="<% call ShowCurrentTerm(1)'此处返回当前学期的编号 %>"/>
<input type="hidden" name="teacher_id" value="<%=request.Cookies("teacher_id")%>" />
<input type="hidden" name="department_id" value="<%=request.Cookies("department_id")%>"/>
<input type="hidden" name="class_id" value="<%=request("class_id")%>"/>
<input type="hidden" name="class_name" value="<%=request("class_name")%>"/>
<select name="subject_id" onchange="InputScoreForm.submit()">
<option value="">请选择课程</option>
<% call TeacherSelectSubject() %></select> </form></td>
<td width="33%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top" height="620" colspan="3"> </td>
<td> </td>
</tr>
</table>
</div>
<div id="bottom">
<iframe src="images/bottom.htm" frameborder="0" scrolling="no" width="100%" height="28"></iframe>
</div>
</body>
</html>
<%end sub
'负责处理添加院系数据的的过程********************************************
sub Add_Score()
Dim Teacher_rs,Teacher_sql,student_name,student_no,stu_sex,teacher_id,department_id,class_id,student_id,Edit_model
Edit_model=request.Form("Edit_model")
Set Teacher_rs=server.CreateObject("adodb.recordset")
student_name=HtmlEncode(request.Form("Teacher_name"))
student_no=HtmlEncode(request.Form("student_no"))
stu_sex=HtmlEncode(request.Form("student_sex"))
department_id=HtmlEncode(request.Form("department_id"))
teacher_id=HtmlEncode(request.Form("teacher_id"))
student_id=HtmlEncode(request.Form("student_id"))
class_id=HtmlEncode(request.Form("class_id"))
If Edit_model=1 then'如果Edit_model=1,则是编辑模式,而不是添加新纪录,此时无需检查是否存在相同的记录,而且要分别书写SQL语句
Teacher_sql="select [student_no],[student_name],[stu_sex],[department_id],[teacher_id],[class_id] from [student] where"&_
"[student_id]='"&student_id&"'"
Teacher_rs.open Teacher_sql,Initialize_Conn,1,3
Teacher_rs("student_name")=student_name
Teacher_rs("student_no")=student_no
Teacher_rs("stu_sex")=stu_sex
Teacher_rs.Update
Teacher_rs.close
Set Teacher_rs=nothing
Call CloseConn()
response.Write("<script>alert('编辑成功,按确定返回.');location.href='Manage_stu.asp?action=showlist&class_name="&request("class_name")&"&class_id="&request("class_id")&"';</script>")
else
'下面的代码是添加新纪录***************
Teacher_sql="select [student_no],[student_name],[stu_sex],[department_id],[teacher_id],[class_id] from [student] where"&_
"[student_no]='"&HtmlEncode(request.Form("student_no"))&"'"
Teacher_rs.open Teacher_sql,Initialize_Conn,1,3
if Teacher_rs.eof AND Teacher_rs.bof then
Teacher_rs.addnew
Teacher_rs("student_name")=student_name
Teacher_rs("student_no")=student_no
Teacher_rs("stu_sex")=stu_sex
Teacher_rs("department_id")=department_id
Teacher_rs("teacher_id")=teacher_id
Teacher_rs("class_id")=class_id
Teacher_rs.Update
Teacher_rs.close
Set Teacher_rs=nothing
Call CloseConn()
response.Write("<script>alert('数据 成功添加.');location.href='Manage_stu.asp?action=showlist&class_name="&request("class_name")&"&class_id="&request("class_id")&"';</script>")
else
Response.Write("<script>alert('对不起,您添加的学号已经存在.');location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
Call CloseConn()
end if
end if
end sub
'编辑 院系部门的过程调用********************************************
sub Edit_Score()
Call Main(1)
Call CloseConn()
end sub
'搜索教师的过程调用,显示页面************************************************************
'显示辅导员所在院系的过程调用************************
Sub Show_teacher_department(id,Show_OR_Edit)''show的意思是数据显示模式,当要显示辅导员列表时是show模式,出于要和显示列表中表格一致的考虑,此时要打印出<td></td>;
'当要修改辅导员的信息是,此时要显示的是edit模式,只需要根据call传递过来的department_id显示辅导员所在院系的汉字描述;
Dim ShowSql,ShowRs
Set ShowRs=server.CreateObject("adodb.recordset")
ShowSql="select department_name from [department] where department_id="&id&""
ShowRs.open ShowSql,Initialize_Conn,1,1
IF Show_OR_Edit=0 Then
response.Write "<td>"&ShowRs("department_name")&"</td>"
else
response.Write ShowRs("department_name")
End if
ShowRs.close
Set ShowRs=nothing
end sub
'显示当前学期的过程调用*********************************
sub ShowCurrentTerm(Name_id)
Dim ShowCurrentTermRs,ShowCurrentTermSql
Set ShowCurrentTermRs=server.CreateObject("adodb.recordset")
ShowCurrentTermSql="select [Term_id],[Term_name] from [term_info] where [Current_Term]=1"
ShowCurrentTermRs.open ShowCurrentTermSql,Initialize_Conn,1,1
if Name_id=0 then
response.Write "<font color=red>"&ShowCurrentTermRs("term_name")&"</font>"
else
response.Write ShowCurrentTermRs("term_id")
End if
ShowCurrentTermRs.close:Set ShowCurrentTermRs=nothing
end Sub
'教师选择课程科目的下列列表*****************************
Sub TeacherSelectSubject()
Dim SelectSubjectRs,SelectSubjectSql
Set SelectSubjectRs=server.CreateObject("adodb.recordset")
SelectSubjectSql="select [subject_id],[subject_name],[auth_teacher] from [subject] where teacher_id='"&request("teacher_id")&"'"
SelectSubjectRs.open SelectSubjectSql,Initialize_Conn,1,1
DO while not SelectSubjectRs.eof
Response.Write("<option value="&SelectSubjectRs("subject_id")&">"&SelectSubjectRs("subject_name")&"</option>")
SelectSubjectRs.movenext
Loop:SelectSubjectRs.close:set SelectSubjectRs=nothing
End Sub
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?