📄 adminsavetch.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#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,id
dim tchno,tchname,tchpwd
action=request.QueryString("action")
tchno=request.Form("tchno")
tchname=request.Form("tchname")
tchpwd=request.Form("tchpwd")
if action="add" then
'*******************************添加教师
set rsa=server.CreateObject("adodb.recordset")
sql="select * from teacher where teacherno='" & tchno & "'"
rsa.open sql,conn,1,1
if rsa.bof and rsa.eof then
sql="insert into teacher(teacherno,teachername,pwd) values('" & tchno & "','" & tchname & "','" & tchpwd & "')"
conn.execute(sql)
response.Write("添加教师")
else
response.Write("教师编号已近被注册!")
end if
elseif action="modify" then
'*****************************修改教师
id=request.Form("id")
set rs=server.CreateObject("adodb.recordset")
sql="select * from teacher where teacherno='" & tchno & "' and teacherid<>" & id
rs.open sql,conn,1,1
if rs.bof and rs.eof then
sql="update teacher set teacherno='" & tchno & "' ,teachername='" & tchname & "' , pwd='" & pwd & "' where teacherid=" & id
conn.execute(sql)
response.Write("修改教师")
else
response.Write("教师编号已经被注册")
end if
elseif action="del" then
id=request.QueryString("id")
set rs=server.CreateObject("adodb.recordset")
sql="select * from teacher where teacherid=" & id
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.Write("错误,没有此教师的信息")
else
sql="delete * from teacher where teacherid=" & id
conn.execute(sql)
response.Write("删除成功")
end if
end if
%>
<a href="adminlisttch.asp">返回</a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -