📄 twork.asp
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>work</title>
</head>
<%
dim conn,connstr,count
connstr="Driver={sql server};UID=sa;PWD=sa;database=zikao;server=BILLGATES"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=Server.CreateObject("ADODB.Recordset")
set rs1=Server.CreateObject("ADODB.Recordset")
%>
<body>
<table border="1" width="480" height="323">
<tr>
<td height="56" width="480" colspan="2">
<p align="center"><b><font size="6">教师工作量计算</font></b></td>
</tr>
<form action="twork.asp" method="post">
<tr>
<td height="42" width="144">教师编号</td>
<td height="42" width="320"><input type="text" name="T1" size="20">
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></td>
</tr>
</form>
<%
if request.form("B1")="提交" then
count=0
tno=request.form("T1")
sql="select * from teacher where tno= '"&tno&"'"
sql1="select * from course where coursetecid= '"&tno&"'"
%>
<tr><%
if tno="" then
response.write"<td height='42' width='144'>请输入教师编号</td>"
else
rs.open sql,conn
if rs.eof then
response.write"<td height='42' width='144'>教师编号不存在</td>"
rs.close
else
'tname=rs(1)
rs1.open sql1,conn
while not rs1.eof
temp=rs1("courselong")
count=count+temp
rs1.movenext
wend
tname=rs(1)
rs.close
%>
<td height="37" width="144">教师姓名</td>
<td height="37" width="320"> <%=tname%></td>
</tr>
<tr>
<td height="37" width="144">工作量(按学时计算)</td>
<td height="37" width="320"> <%=count%></td>
</tr>
<tr>
<td height="125" width="480" colspan="2">
</td>
</tr>
<%
sql3="update teacher set works = '"&count&"' where tno= '"&tno&"'"
rs.open sql3,conn
end if
end if
end if
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -