📄 查阅作业.txt
字号:
<% 'from jxHomeWork1.asp URL链接:?hao=AC&ml=zhe
xuehao = Request.Cookies("jxyd_user_nstu")
xingming = Request.Cookies("jxyd_user_xmin")
sHao = Request.QueryString("hao")
sDir = Request.QueryString("ml")
if left(sHao, 1) = "A" then
sWorkName = "[汇编语言]": sFile = server.MapPath("/jxyd/HomeWork") &"/"& sDir
&"/WorkAput.txt"
else
sWorkName = "[InterNet]": sFile = server.MapPath("/jxyd/HomeWork") &"/"& sDir
&"/WorkTput.txt"
end if
Set MyFile = server.CreateObject ("Scripting.FileSystemObject")
tishu = 0
Set MyText = MyFile.OpenTextFile(sFile, 1) ' 读文本文件
do
sLine = MyText.ReadLine
if mid(sLine, 2, 2) = sHao then
timu = "": tishu = 1: rRiqi = mid(sLine, 5)
elseif left(sLine, 5) = "-end-" then
tishu = 0: exit do
elseif left(sLine,1) = "#" and tishu = 1 then
exit do
else
if tishu = 1 then timu = timu & sLine &"<br>"
end if
loop
MyText.close
if tishu = 0 then Response.Write "<body><center><font color=red><b><big>无此作业号,或正在
批改</big></b>": Response.End
Set dbc = Server.CreateObject("ADODB.Connection")
strConn = "driver={Microsoft Access Driver (*.mdb)}"
dbc.open strConn & ";dbq=" & Server.MapPath( "/jxyd/HomeWork/"& sDir &"/Work"&
sHao &".mdb")
sql = "select * from 作业题目 where 学号='" & xuehao & "'"
Set rs = dbc.execute(sql)
if rs.eof then '以前未提交过作业
sReadFromDB = "你未提交过"& sHao &"作业"
jihao = "404-?.?"
else
sReadFromDB = rs("内容")
ri_qi = rs("日期"): defen = rs("得分"): dping = rs("点评"): jihao = rs("机号")
end if
%>
<html><head><title>查询数据库作业</title>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type">
<style type="text/css">
body{font-family:宋体;font-size:14px}
td{font-family:宋体,arial;font-size:14px}
</style>
</head>
<%
Response.Write "<body bgColor=#D9ECFF><table border='0' width='90%' align='center'
cellspacing='1'>"&_
"<tr><td><font style='FONT-SIZE: 35px' color=red><b>查询数据库作业
</b></font></td></tr></table>"
Response.Write "<table border=0 cellpadding=1 cellspacing=1 width='95%'>"&_
"<tr><td colspan=4><b>"& sWorkName &"作业号</b>:<font color=red>"& sHao &"</font>
(至 "& rRiqi &" 完成)"&_
"<br><b>题目</b>:</td></tr>"&_
"<tr><td colspan=4><font color=blue>"& timu &"</font><hr width=100% align=left></td></tr>"
if right(xuehao,2) = "99" then
Set rs = dbc.execute("select count(*) from 作业题目")
Response.Write "<tr><td colspan=4><b>"& sHao &" 作业提交人数:</b>"& rs(0) &"
("& left(xuehao,4) &"班)</td></tr>"
Set rs = dbc.execute("select 学号,得分 from 作业题目 order by 学号")
stemp = "": j = 0
do until rs.eof
stemp = stemp & rs(0) &" <font color=blue>"& rs(1) & "</font> "
j = j + 1: if j mod 8 = 0 then stemp = stemp &"<br>"
rs.movenext
loop
Response.Write "<tr><td colspan=4>"& sTemp &"</td></tr>"
else
Response.Write "<tr><td width=120><b>学号</b>:<font color=blue>"& xuehao
&"</font></td>"&_
"<td width=120><b>姓名</b>:<font color=blue>"& xingming &"</font></td>"&_
"<td><b>提交作业时间</b>:<font color=blue>"& ri_qi &"</font></td>
<td width='*'> </td></tr>"&_
"<tr><td colspan=4>"&_
"<textarea name='zuoye' rows='14' cols='80' style='BACKGROUND-COLOR: FAFCEE;
FONT-FAMILY: 宋体; FONT-SIZE: 14px'>"&_
sReadFromDB &"</textarea></td></tr>"&_
"<tr><td colspan=4><b>得分</b>:"& defen &" <b>点评</b>:"& dping &"</td></tr>"
end if
sql = "select * from 作业题目 where 备注A='9'"
Set rs = dbc.execute(sql)
if rs.eof then '无作业范例
Response.Write "</table>"
else
sReadFromDB = rs("内容")
sReadFromDB = replace(sReadFromDB, "<BR>", vbCrLf )
ri_qi = rs("日期"): defen = rs("得分")
dping = rs("点评"): xuehao = rs("学号")
Response.Write "<tr><td colspan=4><hr></td></tr>"&_
"<tr><td><b> "& sHao &" 作业范例</b></td>"&_
"<td><b>学号</b>:<font color=blue>"& xuehao &"</font></td>"&_
"<td><b>提交作业时间</b>:<font color=blue>"& ri_qi &"</font></td></tr>"&_
"<tr><td colspan=4>"&_
"<textarea name='zuoye' rows='14' cols='80'style='BACKGROUND-COLOR: ffffff;
FONT-FAMILY: 宋体; FONT-SIZE: 14px'>"&_
sReadFromDB &"</textarea></td></tr>"&_
"<tr><td colspan=4><b>得分</b>:"& defen &" <b>点评</b>:
"& dping &"</td></tr></table>"
end if
rs.Close: Set rs = Nothing: dbc.Close: Set dbc = Nothing
Response.Write "</body></html>"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -