⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subjectquery.asp

📁 本系统用来开发网络开发系统的实现
💻 ASP
字号:
<!--#include file="adovbs.inc" -->
<HTML>

<BODY>
<P align="center"><STRONG><FONT face="华文彩云" color=darkred  size=6>课程查询</FONT></STRONG></P>

<%
	const N=3
	set conn1=server.CreateObject("adodb.connection")
	set rs1=server.CreateObject("adodb.recordset")
	
	conn1.Open  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("s223bsh02.mdb") &  ";Persist Security Info=False"
	
	rs1.PageSize=N
	rs1.Open "select * from 课程",conn1,adOpenStatic
	
	pageth=Request.QueryString("pageth")
	'判断页数是否为空
	if pageth="" then pageth="1"
	'判断页数是否为数字
	if not IsNumeric(pageth) then pageth="1"
	'判断数字是否大于总页数
	pageth=cint(pageth)
	if pageth>rs1.PageCount then pageth=rs1.PageCount 
	
	rs1.AbsolutePage=pageth
%>
<table align=center border=1 cellpadding=0 cellspacing=0 >
<tr><td colspan="3">共有<%=rs1.RecordCount%>条记录,每页<%=N%>条,共<%=rs1.PageCount%>页,当前是第<%=rs1.AbsolutePage%>页</td></tr>
<tr align=center>
	<td width="10%"><b>课程编号</b></td>
	<td width="40%"><b>课程名称</b></td>
	<td width="20%"><b>学期</b></td>
	
</tr>
<%	
	for i=1 to N
%>
		<tr align=center>
		<td><%=rs1(0)%></td>
		<td><%=rs1(1)%></td>
		<td><%=rs1(2)%></td>	
</tr>
<%		
		rs1.MoveNext 
		if rs1.EOF then exit for  '避免存在半页时循环出现问题;
	next	
	pagepre=pageth-1
	pagenext=pageth+1
	if pagepre<1 then pagepre=1
	if pagenext>rs1.PageCount then pagenext=rs1.PageCount 
%>
<tr>
<td colspan=3>
<form action="QuestionQuery.asp" method="get" id=form1 name=form1>
<%
'如果当前页不是第一页,则显示;
if pageth<>1 then
%>
<a href="QuestionQuery.asp?pageth=1">第一页</a> | 
<a href="QuestionQuery.asp?pageth=<%=pagepre%>">上一页</a> | 
<%
end if
'如果当前页不是最后一页,则显示;
if pageth<>rs1.PageCount then
%>
<a href="QuestionQuery.asp?pageth=<%=pagenext%>">下一页</a>
<a href="QuestionQuery.asp?pageth=<%=rs1.PageCount%>">最后一页</a> | 
<%
	end if
%>
转向第<input name="pageth"  size=2>页
	<input type="submit" value=" GO " id=submit1 name=submit1>
</form>
<%
	rs1.Close
	conn1.Close
%>
</td>
</tr>
</table>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -