📄 ks.asp
字号:
<!--#include file="Inc/Check.asp"-->
<!--#include file="Inc/oConn.asp"-->
<!--#include file="Inc/Info.asp"-->
<!--#include file="Inc/Page.asp"-->
<!--#include file="Inc/Public.asp"-->
<%
On Error Resume Next
Call CheckAdmin(",1,",","&Session("JB")&",")
Dim action,id
action = RQuery("action")
id = RQuery("id")
If action&""<>"" Then action = LCase(action)
Select Case action
Case "addsave"
Call addsave()
Case "editsave"
Call editsave()
Case "delsave"
Call delsave()
End select
Call listface()
If Err Then
Call ShowErrs()
End If
Sub addface()
%>
<table width="250" cellpadding="5" cellspacing="1" align="center" class="table1">
<form method="post" action="?Action=AddSave" onsubmit="return checkF();">
<tr class="thead">
<td colspan="2" align="left">添加资料>></td>
</tr>
<tr class="tbody">
<td>考试名称</td>
<td><input type="text" name="考试名称" size="20"></td>
</tr>
<tr class="tbody">
<td colspan="2" align="center"><input type="submit" value="添加资料"> <input type="reset" value="重新填写"></td>
</tr>
</form>
</table>
<%
End Sub
Sub editface()
Dim strSQL,objRs
Dim KSMC
strSQL = "Select 考试名称 from ksName where ksID="&id&""
Set objrs = oconn.execute(strsql)
If Not objrs.eof Then
KSMC = objRs(0)
Else
response.Write "参数错误!"
Set objrs = nothing
Call closeConn()
response.End
End If
Set objRs = nothing
%>
<table width="250" cellpadding="5" cellspacing="1" align="center" class="table1">
<form method="post" action="?Action=EditSave&ID=<%=id%>" onsubmit="return checkF();">
<tr class="thead">
<td colspan="2" align="left">编辑资料>></td>
</tr>
<tr class="tbody">
<td>考试名称</td>
<td><input type="text" name="考试名称" size="20" value="<%=KSMC%>"></td>
</tr>
<tr class="tbody">
<td colspan="2" align="center"><input type="submit" value="保存编辑"> <input type="button" value="取消编辑" onclick="location.href='?'"></td>
</tr>
</form>
</table>
<%
End Sub
Sub listface()
Call PHead("考试项目管理")
Call Waiting()
%>
<div class="thetitle">考试项目管理</div>
<hr size="1" color="#b8b8b8"/>
<table align="center">
<tr valign="top">
<td>
<table width="500" cellpadding="5" cellspacing="1" align="center" class="table1">
<tr class="thead">
<td width="5%">ID</td>
<td width="80%">考试名称</td>
<td colspan="2" width="15%">功能</td>
</tr>
<%
Dim objRs,strSQL,MyPage,wName,i
wName = RQuery("cName")
strSQL = "Select ksID,考试名称 From ksName"
strSQL = strSqL & " Order by ksID Desc"
Set MyPage = New xdownpage
MyPage.GetConn = oConn
MyPage.GetSQL = strSQL
MyPage.PageSize = 14
Set objRs = MyPage.GetRs()
If Not objRs.Eof Then
For i = 1 To MyPage.PageSize
%>
<tr class="tbody" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#f5f5f5'">
<td><%=objRs(0)%></td>
<td><%=objRs(1)%></td>
<td width="30"><a href="?Action=Edit&ID=<%=objRs(0)%>">编辑</a></td>
<td width="30"><a href="?Action=DelSave&ID=<%=objRs(0)%>" onclick="return confirm('你真的要删除此条资料吗?此操作不可恢复!!')">删除</a></td>
</tr>
<%
objRs.MoveNext
If objRs.Eof Then Exit For
Next
Else
%>
<tr><td colspan="4" class="tbody" height="60" align="center">暂无资料</td></tr>
<%
End If
Set objRs = Nothing
%>
<tr><td colspan="4" class="tbody"><%=MyPage.ShowPage()%></td></tr>
</table>
</td>
<td>
<%
If action="edit" Then
Call editface()
Else
Call addface()
End If
%>
</td>
</tr>
</table>
<script language="javascript">
function checkF()
{
if (document.forms[0].考试名称.value=="")
{
window.alert('考试名称不能为空!');
document.forms[0].考试名称.focus();
return false;
}
}
</script>
<%
Call HWaiting()
Call PFoot()
End Sub
%>
<%
Sub addsave()
On Error Resume Next
Dim strSQL
Dim KSMC
KSMC = FQuery("考试名称")
strSQL = "insert into ksName (考试名称) values ('"&KSMC&"')"
oConn.Execute(strSQL)
If Err Then
Call SaveLog(Session("XM"),"考试管理","添加考试项目失败")
Call closeconn()
Call JavaScript("alert('添加失败!');location.href='?';")
Else
Call SaveLog(Session("XM"),"考试管理","添加考试项目成功")
Call JavaScript("alert('添加成功!');location.href='?';")
End If
End Sub
Sub editsave()
On Error Resume Next
Dim strSQL
Dim KSMC
KSMC = FQuery("考试名称")
strSQL = "update ksName set 考试名称='"&KSMC&"' where ksID="&id&""
oConn.Execute(strSQL)
If Err Then
Call SaveLog(Session("XM"),"考试管理","更新考试项目失败")
Call closeconn()
Call JavaScript("alert('更新失败!');location.href='?';")
Else
Call SaveLog(Session("XM"),"考试管理","更新考试项目成功")
Call JavaScript("alert('更新成功!');location.href='?';")
End If
End Sub
Sub delsave()
On Error Resume Next
Dim strSQL
'//删除考试项目
strSQL = "delete from ksName where ksid="&id&""
oConn.Execute(strSQL)
'//删除考试项目成绩数据
strSQL = "delete from cjTable where ksid="&id&""
oConn.Execute(strSQL)
'//删除考试项目成绩统计
strSQL = "delete from sumCJ where ksid="&id&""
oConn.Execute(strSQL)
If Err Then
Call SaveLog(Session("XM"),"科目管理","删除考试科目失败")
Call closeconn()
Call JavaScript("alert('删除失败!');location.href='?';")
Else
Call SaveLog(Session("XM"),"科目管理","删除考试科目成功")
Call JavaScript("alert('删除成功!');location.href='?';")
End If
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -