slist.asp
来自「《动态网页设计基础教程》,胡杰,科学出版社」· ASP 代码 · 共 208 行
ASP
208 行
<!-- #include file="adoconn.asp" -->
<%
IF request.form("cmdadd")="添加" then
Session("EditFlag")="INSERT"
response.redirect "Sedit.asp"
END IF
IF request.form("cmdDel")="删除" then
Adoconnection()
for each item in request("Selected")
Adoconn.Execute "delete from students where SNo='" & item & "'" ,,1
next
set Adoconn=nothing
%>
<script language="vbscript">
history.go(-2)
</script>
<%
END IF
IF request.form("cmdMdy")="修改" THEN
Dim RecordsetArray
Dim LocalArray(100)
Dim fi
Adoconnection()
for each item in request("Selected")
Session("SNo")=item
Session("EditFlag")="MODIFY"
set RS=Adoconn.Execute ("select * from students where SNo='" & item & "'")
RecordArray=RS.GetRows()
for fi=0 to RS.FIELDS.COUNT-1
LocalArray(fi)=RecordArray(fi,0)
next
Session("Scollege")=LocalArray(6)
Session("DataArray")=LocalArray
Set RS=nothing
set Adoconn=nothing
Response.Redirect ("Sedit.asp")
next
END IF
%>
<html>
<head>
<link rel="stylesheet" href="comCSS.css">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>学生信息管理</title>
<base target="rbottom">
<meta name="Microsoft Border" content="t, default">
</head>
<body ><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>
<p align="left"> </p>
</td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td valign="top">
<%
Dim sql
Dim reccount
Dim fieldi,recordi
t1=request("T1")
t2=request("T2")
t3=request("T3")
r1=request("R1")
r2=request("R2")
Certificate()
IF t1<>"" or t2<>"" or t3<>"" THEN
sql="select * from Students where "
if t1<>"" then
sql=sql + " SID='" + t1 + "'"
end if
if t2<> "" then
if t1 <> "" then
sql = sql + R1 + "SNO='" + t2 + "' "
else
sql=sql + "SNO='" + t2 +"' "
end if
end if
if t3 <> "" then
if t2 <> "" then
sql = sql + R2
elseif t1 <> "" then
sql = sql + R1
end if
sql =sql + "Sname='" + D1 + "'"
end if
ELSE
sql="select * from Students "
END IF
SQL=SQL+ " ORDER BY SNAME"
Set Rs=GetRecordset(sql)
IF not rs.eof then
Reccount=rs.RecordCount
Page=Request.QueryString("Page")
Psize=Request.QueryString("PageSize")
If Psize="" Then
Psize=7
End if
Rs.PageSize=Psize
Pages=Rs.PageCount
If Page<1 Then Page=1
If Page=NULL Then Page=1
'If Page>Pages Then Page=Pages
Rs.AbsolutePage=Page
END IF
%>
<form method="post">
<table border=0 cellspacing="0">
<tr>
<td><font face="华文行楷" size="4" color="#FF0000"><b>学生信息列表 </b></font> [Page <%=page%> 0f <%=Pages%>][ 记录总数:<%=Reccount%>]</td>
</table>
<div align="left">
<table border="0" width="956">
<tr bgcolor=#ccccc7>
<td width="66" colspan="2" align="center">
<p align="right"><font color="#000080"><b> 学号</b></font>
</td>
<td width="72" align="center">
<p align="center"><font color="#000080"><b>姓名</b></font></p>
</td>
<td width="51" align="center">
<p align="right"><font color="#000080"><b>性别</b></font></p>
</td>
<td width="121" align="center">
<p align="center"><font color="#000080"><b>出生日期</b></font></p>
</td>
<td width="91" align="center">
<p align="center"><font color="#000080"><b>身份证号</b></font></p>
</td>
<td width="135" align="center">
<p align="center"><font color="#000080"><b>所在院系</b></font></p>
</td>
<td width="118" align="center"><font color="#000080"><b>所在班级</b></font></td>
<td width="98" align="center"><font color="#000080"><b>入学日期</b></font></td>
</tr>
<%for recordi=1 to rs.PageSize
if rs.Eof then Exit for
if recordi mod 2=0 then
color="#ddddd7"
else
color="#eeeeef"
end if
response.write ("<tr bgcolor=" + color +">")
%>
<td width="46"><input type="checkbox" name="Selected" value="<%=rs(0) %>"></td>
<td width="14"><% =rs(0) %></td>
<td width="72"><% =rs(1) %></td>
<td width="51"><% =rs(2) %></td>
<td width="121"><% =rs(3) %></td>
<td width="91"><% =rs(5) %></td>
<td width="135"><% =rs(6) %></td>
<td width="118"><% =rs(7) %></td>
<td width="98"><% =rs(8) %></td>
<%response.write ("</tr>")%>
<% rs.movenext%>
<%next%>
</table>
</div>
<%
Set rs=nothing
Set Adoconn=nothing
%>
<%scriptname=request.servervariables("script_name")%>
<br>
<a href="<%=scriptname%>?Page=1&PageSize=<%=Psize%>&t1=<%=t1%>&t2=<%=t2%>&D1=<%=D1%>&r1=<%=r1%>&r2=<%=r2%>">第一页</a>
<a href="<%=scriptname%>?Page=<%=(Page+1)%>&PageSize=<%=Psize%>&t1=<%=t1%>&t2=<%=t2%>&t3=<%=D1%>&r1=<%=r1%>&r2=<%=r2%>">下一页</a>
<a href="<%=scriptname%>?Page=<%=(Page-1)%>&PageSize=<%=Psize%>&t1=<%=t1%>&t2=<%=t2%>&t3=<%=D1%>&r1=<%=r1%>&r2=<%=r2%>">上一页</a>
<a href="<%=scriptname%>?Page=<%=(Pages)%>&PageSize=<%=Psize%>&t1=<%=t1%>&t2=<%=t2%>&t3=<%=D1%>&r1=<%=r1%>&r2=<%=r2%>">最后一页</a> <p>
<input type="submit" value="删除" name="cmddel"> <input type="submit" value="添加" name="cmdadd">
<input type="submit" value="修改" name="cmdmdy"> <a href="javascript:history.back(2)">返回</a>
</p>
</form>
<!--msnavigation--></td></tr><!--msnavigation--></table></body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?