📄 stdchoose.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="stdpurview.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<!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>无标题文档</title>
</head>
<body>
<%
dim action,cno
dim rs,rsc,sql
dim stuno
action=request.QueryString("action")
if action<>"" then
'获得表单提交数据
cno=request.Form("courseno")
'检查表单提交数据是否可用
set rschk=server.CreateObject("adodb.recordset")
sql="select * from course where courseno='" & cno & "'"
'response.write(sql)
'response.end()
rschk.open sql,conn,1,1
if rschk.bof and rschk.eof then
response.Write("课程号不存在,请查阅后再填写")
else
dim cid,sid
'利用课程编号得到课程的ID
cid=getCIDbyCNO(cno)
'利用学成编号得到学生的ID
sid=getStuIDbyStuNO(session("user"))
if action="chk" then
'添加选课
sql="insert into choose(courseid,studentid) values(" & cid & "," & sid & ")"
conn.execute(sql)
response.Write("添加成功")
elseif action="del" then
set rsdel=server.CreateObject("adodb.recordset")
sql="select * from choose where courseid=" & cid & " and studentid=" & sid
rsdel.open sql,conn,1,1
if rsdel.eof and rsdel.bof then
response.Write("您没有选此项课程,请查阅后在填写")
else
'删除选课
sql="delete * from choose where courseid=" & cid & " and studentid=" & sid
conn.execute(sql)
response.Write("删除成功")
end if
end if
end if
end if
%>
<%
'<--------开始显示部分------------〉
'获得学生学号
stuno=session("user")
'response.Write(stuno)
set rs=server.CreateObject("adodb.recordset")
'通过学生学号获得学生所学的课程信息
sql="SELECT Student.StuNO, choose.CourseID, choose.mark FROM Student INNER JOIN choose ON Student.StuID = choose.StudentID WHERE Student.StuNO='" & stuno & "'"
'response.Write(sql)
'response.End()
rs.open sql,conn,1,1
%>
<table width="100%" border="0">
<tr>
<td colspan="6">已选课程</td>
</tr>
<tr>
<td>课程编号</td>
<td>课程名称</td>
<td>上课时间</td>
<td>任课教师</td>
<td>备注</td>
<td>得分</td>
</tr>
<%
if not rs.eof and not rs.bof then
do while not rs.eof
set rsc=server.CreateObject("adodb.recordset")
'根据课程ID查询课程详细ID
sql="SELECT course.CourseNo, course.CourseName, course.CourseTime, Teacher.TeacherName, course.CourseRemake, course.CourseID FROM Teacher INNER JOIN course ON Teacher.TeacherID = course.teacherID WHERE (course.CourseID)=" & rs("courseid")
rsc.open sql,conn,1,1
if not rsc.eof and not rsc.bof then
%>
<tr>
<td><%=rsc("CourseNo")%></td>
<td><%=rsc("CourseName")%></td>
<td><%=rsc("CourseTime")%></td>
<td><%=rsc("TeacherName")%></td>
<td><%=rsc("CourseRemake")%></td>
<td><%=rs("mark")%></td>
</tr>
<%
end if
rsc.close
rs.movenext
loop
end if
%>
</table>
<form id="form1" name="form1" method="post" action="stdchoose.asp?action=chk">
<table width="200" border="0">
<tr>
<td colspan="2">选择课程</td>
</tr>
<tr>
<td>课程编号</td>
<td><input type="text" name="courseno" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
</form>
<form id="form2" name="form2" method="post" action="stdchoose.asp?action=del">
<table width="200" border="0">
<tr>
<td colspan="2">删除课程</td>
</tr>
<tr>
<td>课程编号</td>
<td><input type="text" name="courseno" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -