📄 tecinfo.asp
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>teacher info input</title>
</head>
<body leftmargin="150">
<%
dim conn,connstr
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")
sql="select * from department"
rs.open sql,conn
%>
<table border="1" width="352" height="407">
<tr>
<td height="55" width="342" colspan="2">
<p align="center">教师信息录入</td>
</tr>
<form action="tecinfo.asp" method="post">
<tr>
<td height="26" width="125">教师编号</td>
<td height="26" width="211"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td height="28" width="125">教师姓名</td>
<td height="28" width="211"><input type="text" name="T2" size="20"></td>
</tr>
<tr>
<td height="25" width="125">教师职称</td>
<td height="25" width="211"><select size="1" name="DT">
<option value="讲师">讲师</option>
<option value="副教授">副教授</option>
<option value="教授">教授</option>
</select></td>
</tr>
<tr>
<td height="26" width="125">所在系</td>
<td height="26" width="211"><select size="1" name="DD">
<%
if not rs.eof then
rs.movefirst
while not rs.eof
%>
<option value="<%=rs(1)%>"><%=rs(1)%></option>
<%
rs.movenext
wend
end if
rs.close
%>
</select></td>
</tr>
<tr>
<td height="46" width="342" colspan="2">
<p align="center">
<input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</form>
<tr>
<td height="172" width="342" colspan="2">
<%
if request.form("B1")="提交" then
tecno=request.form("T1")
tecname=request.form("T2")
tecl=request("DT")
tecd=request("DD")
sql1="select * from teacher where tno= '"&tecno&"'"
if tecno="" or tecname="" then
response.write"信息输入不完整"
else
rs.open sql1,conn
if not rs.eof then
response.write"教师编号已存在"
rs.close
else
rs.close
sql2="insert into teacher values('"&tecno&"','"&tecname&"','"&tecl&"','"&"0"&"','"&tecd&"')"
rs.open sql2,conn
response.write"录入成功"
end if
end if
end if
%>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -