📄 teacher_course.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="include/ReplaceHtml.asp"-->
<!--#include file="include/TeacherSession.asp"-->
<%
Dim Action
Action=request.QueryString("Action")
Select Case Action
Case "Add_Term"
Call Add_Term()
Case "Edit_Term"
Call Edit_Term()
Case "Set_Current"
Call Set_Current()
Case "SetCurrentTerm"
Call SetCurrentTerm()
Case "Del_Term"
Call Del_Term()
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_Term_sql,Edit_Term_rs
Call OpenConn()
Edit_Term_sql="select * from [subject] where subject_id='"&request.QueryString("Term_id")&"'"
Set Edit_Term_rs=server.CreateObject("adodb.recordset")
Edit_Term_rs.open Edit_Term_sql,Initialize_Conn,1,3
End if
%>
<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>
</head>
<body background="axhucj/images/admin_MainBg.gif">
<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%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="19%" height="19"> </td>
<td width="31%"> </td>
<td width="33%"> </td>
<td width="17%"> </td>
</tr>
<tr>
<td height="28"> </td>
<td align="center" colspan="2"><div align="center">
<script language="javascript">
function CheckForm() {
if(myform.Term_Name.value == '') {
alert('请输入要添加的课程的名称!');
myform.Term_Name.focus();
return false;
}
}
</script>
<form name="myform" method="post" action="Teacher_Course.asp?Action=Add_Term" onSubmit="return CheckForm()">
<% if Form_State=1 then
response.Write("<font color=""green"">【</font><font color=red>课程信息编辑</font><font color=""green"">】</font>")
else
response.Write("<font color=""red"">【</font>添加课程<font color=""red"">】</font>")
end if
%>
<input value="<% if Form_State=1 then response.Write(Edit_Term_rs(1))%>" type="text" size="20" name="Term_Name"><font color="red">*</font> 必填
授课教师:
<input value="<% if Form_State=1 then response.Write(Edit_Term_rs(2))%>" size="15" type="text" name="auth_teacher" title="只允许使用中文名称.">* 可选填
<input type="hidden" name="teacher_id" value="<%=request.Cookies("teacher_id")%>">
<% if Form_State=1 then
response.Write(" <input type=""submit"" name=""Submit"" value=""完成编辑"" /></div></td>")
response.Write("<input type=""hidden"" name=""Edit_model"" value=""1"">")
response.Write("<input type=hidden name=Term_id value="""&Edit_Term_rs(0)&""">")
else
response.Write("<input type=""submit"" name=""Submit"" value=""确定""/></div></td>")
end if
%>
</form>
</div></td>
<td> </td>
</tr>
<tr>
<td height="328"> </td>
<td align="center" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" height="323" colspan="3"><table bgcolor="#8ab105" width="100%" border=0 cellpadding=0 cellspacing=1>
<tr bgcolor="#FFFFFF">
<td height="22"><div align="center">课程编号</div></td>
<td><div align="center">课程名称</div></td>
<td><div align="center">授课教师姓名</div></td>
<td><div align="center"><font color="red">管理操作</font></div></td>
</tr>
<% Dim TermList_rs,Term_sql,page,epage
Set TermList_rs=server.CreateObject("adodb.recordset")
Term_sql="select * from [subject] order by [subject_id] desc"
TermList_rs.open Term_sql,Initialize_Conn,1,1
'*****************分页代码**********************************
TermList_rs.pagesize=30
page=HtmlEncode(request("page"))
if page <> "" then
if isnumeric(page)=false then
response.write "<script>alert('非法参数!');history.go(-1);</script>"
'response.Write page
response.end
end if
epage=cint(HtmlEncode(request("page")))
if epage<1 then epage=1
if epage>TermList_rs.pagecount then epage=TermList_rs.pagecount
else
epage=1
end if
if TermList_rs.bof or TermList_rs.eof then
response.Write("<br><font color=red>暂时没有记录.</font>")
response.End()
end If
TermList_rs.absolutepage=epage
for i=0 to TermList_rs.pagesize-1
if TermList_rs.bof or TermList_rs.eof then exit for' 当数据库中的记录数小于for循环中的i的值时,退出for循环
%>
<tr bgcolor="#FFFFFF" align=center>
<td><%=TermList_rs(0)%></td>
<td><%=TermList_rs(1)%></td>
<td><%=TermList_rs(2)%>
</td>
<td><a href=Teacher_Course.asp?action=Edit_Term&Term_id=<%=TermList_rs(0)%>>编辑</a> <a onClick="return confirm('确定要删除这个课程吗? 警告!该课程所对应的所有成绩都将被删除!');" href=Teacher_Course.asp?action=Del_Term&Term_id=<%=TermList_rs(0)%>>删除</a></td>
</tr>
<%
TermList_rs.movenext()
next
%>
</table>
<%
response.write ("<p align=center>")
response.write ("<a href=Teacher_Course.asp?action=showlist&page=0>首页</a> ")
response.write ("<a href=Teacher_Course.asp?action=showlist&page="&epage-1&">前一页</a> ")
response.write ("<a href=Teacher_Course.asp?action=showlist&page="&epage+1&">后一页</a> ")
response.write ("<a href=Teacher_Course.asp?action=showlist&page="&TermList_rs.pagecount&">末页</a>")
response.write ("<p align=center>现在是第<font color=red>"&epage&"</font>页一共有<font color=red>"&TermList_rs.pagecount&"</font>页</p>")
'******************分页代码结束*****************************************
TermList_rs.close
Set TermList_rs=nothing
Call CloseConn()
%>
</td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="50" colspan="4"> </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 Del_Term()
Dim Term_id,Del_Term_sql
Call OpenConn()
Term_id=HtmlEncode(request.QueryString("Term_id"))
Del_Term_sql="delete from [subject] where Subject_id='"&Term_id&"'"
Initialize_Conn.execute Del_Term_sql
Call CloseConn()
Response.Write("<script>location.href='Teacher_Course.asp?Action=showlist';</script>")
End Sub
'添加 或 编辑学期的过程调用**************************
sub Add_Term()
Dim Term_rs,Term_id,Term_sql,Term_name,Edit_model
Edit_model=request.Form("Edit_model")
Set Term_rs=server.CreateObject("adodb.recordset")
Term_id=HtmlEncode(request.Form("Term_id"))
Term_name=HtmlEncode(request.Form("Term_name"))
auth_teacher=HtmlEncode(request.Form("auth_teacher"))
teacher_id=HtmlEncode(request.Form("teacher_id"))
If Edit_model=1 then'如果Edit_model=1,则是编辑模式,而不是添加新纪录,此时无需检查是否存在相同的记录,而且要分别书写SQL语句
Term_sql="select [subject_name],[auth_teacher] from [subject] where"&_
"[subject_id]='"&HtmlEncode(request.Form("Term_id"))&"'"
Term_rs.open Term_sql,Initialize_Conn,1,3
Term_rs("auth_teacher")=auth_teacher
Term_rs("subject_name")=Term_name
Term_rs.Update
Term_rs.close
Set Term_rs=nothing
Call CloseConn()
response.Write("<script>alert('编辑成功,按确定返回.');location.href='Teacher_Course.asp?action=showlist';</script>")
else
Term_sql="select [subject_name],[auth_teacher],[teacher_id] from [subject] where"&_
"[subject_name]='"&HtmlEncode(request.Form("Term_name"))&"'"&_
"order by subject_id desc"
Term_rs.open Term_sql,Initialize_Conn,1,3
if Term_rs.eof AND Term_rs.bof then
Term_rs.addnew
Term_rs("subject_name")=Term_name
Term_rs("auth_teacher")=auth_teacher
Term_rs("teacher_id")=teacher_id
Term_rs.Update
Term_rs.close
Set Term_rs=nothing
Call CloseConn()
response.Write("<script>location.href='Teacher_Course.asp?action=showlist';</script>")
else
Response.Write("<script>alert('对不起,您添加的名称已经存在.');location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
Call CloseConn()
end if
end if
End Sub
'负责编辑学期的过程调用*************************
sub Edit_Term()
Call Main(1)
Call CloseConn()
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -