| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 545 人关注过本帖
标题:查询后分页显示出问题.
只看楼主 加入收藏
changhai_14
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-5-3
收藏
 问题点数:0 回复次数:4 
查询后分页显示出问题.

<!--#include file="..\inc\conn.asp"-->
<!--#include file="..\inc\SessionCheck.asp"-->
<%
Call DBConnBegin()
dim course
course=Request.Form("course")
%>

<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>数字实验室——选课查询</title>
<link rel="stylesheet" href="..\inc\style.css" type="text/css">
</head>

<body topmargin="0" leftmargin="0">
<!--#include file="..\saCommonFile\pagehead.asp"-->
<table width="789" border="0" align="center">
<tr><td width="783" align=left>
<table width="776" height="35" cellspacing="0" cellpadding="0">
<td background="../images/top_1.jpg">&nbsp; <a href="doSelect.asp" class="link">选、退课处理</a>
| <a href="coursemanage.asp" class="link">课程信息处理</a>
| <a href="coursesearch.asp" class="link">选课信息查询</a></table>
<div align="center">
<center><form method="POST" action="coursesearch.asp">
<table border="0" width="700" cellspacing="0" cellpadding="0">
<tr><td align="right">课程选择:<select size="1" name="course"><%
sSql="select * from CourseInfo order by CID"
oRs.open sSql,oConn,3,2
do while not oRs.eof%><option value="<%=oRs("CID")%>" <%if course=oRs("CID") then Response.write "selected" end if%>><%=oRs("CName")%></option>
<%oRs.movenext
loop
oRs.close%></select>&nbsp;<input type="submit" value="查询" name="B1"></td></tr></table></form>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<%
sSql="select * from StuInfo where StuID in (select StuID from CourseSelectedInfo where CID='"&course&"')"
oRs.open sSql,oConn,1,1
if Not(oRs.bof and oRs.eof) then'判别数据表中是否为空记录
dim NumRecord,NumPage,NoncePage,i
NumRecord=oRs.recordcount
oRs.pagesize=10
NumPage=oRs.Pagecount
if request("page")=empty then
NoncePage=1
else
if Cint(request("page"))<1 then
NoncePage=1
else
NoncePage=request("page")
end if
if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
end if
else
NumRecord=0
NumPage=0
NoncePage=0
end if
%>
<table border="1" width="700" bordercolorlight="#000000" cellspacing="0" cellpadding="5" bordercolordark="#FFFFFF">
<tr><td align="center" colspan="6">选择该实验课的学生列表</td></tr>
<tr>
<td width="71" bgcolor="#EBE9FE" align="center">学号</td>
<td width="78" bgcolor="#EBE9FE" align="center">姓名</td>
<td width="65" bgcolor="#EBE9FE" align="center">性别</td>
<td width="78" bgcolor="#EBE9FE" align="center">班级</td>
<td width="90" bgcolor="#EBE9FE" align="center">专业</td>
<td width="80" bgcolor="#EBE9FE" align="center">联系电话</td>
</tr>
<%if Not(oRs.bof and oRs.eof) then
oRs.move (Cint(NoncePage)-1)*10,1
for i=1 to oRs.pagesize
%>

<tr>
<td width="71" align="center"><%=oRs("StuID")%></td>
<td width="78" align="center"><%=oRs("StuName")%></td>
<td width="65" align="center"><%=oRs("Stusex")%></td>
<td width="78" align="center"><%=oRs("Class")%></td>
<td width="90" align="center"><%=oRs("Major")%></td>
<td width="80" align="center"><%=oRs("Tele")%></td>
</tr>
<% oRs.movenext
if oRs.eof then exit for
next
else
response.write "<tr><td colspan=13><marquee scrolldelay=120 behavior=alternate>没有找到任何记录!!!</marquee></td></tr>"
end if

oRs.close
%>

</table>
</table>
<table width="783" border="0">
<tr><td width="748" height="17">
<div align="right">
<input type="hidden" name="page" value="<%=NoncePage%>">
<%
if NoncePage>1 then
response.write "|<a href=coursesearch.asp?page=1>首 页</a>| |<a href=coursesearch.asp?page="&NoncePage-1&">上一页</a>|&nbsp"
else
response.write "|首 页| |上一页|&nbsp"
end if
if Cint(Trim(NoncePage))<Cint(Trim(NumPage)) then
response.write "|<a href=coursesearch.asp?page="&NoncePage+1&">下一页</a>| |<a href=coursesearch.asp?page="&NumPage&">尾 页</a>|"
else
response.write "|下一页| |尾 页|"
end if
%>
&nbsp;页次:<font color="#0033CC"><%=NoncePage%></font>/<font color="#0033CC"><%=NumPage%></font>
共<font color="#0033CC"><%=NumRecord%></font>条记录&nbsp; </div>
</td></tr>
</table>
</center></div>
</td></tr></table>
<%Call DBConnEnd()%>
<!--#include file="..\saCommonFile\pagefoot.asp"-->
</body>
</html>

如果超过10个符合条件的.它会显示正确的页数与条数.但是一点击下一页就出问题,显示没有任何记录!!!
请教高手帮忙啊/先谢谢了

搜索更多相关主题的帖子: 查询 
2006-05-03 17:11
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
course=Request.Form("course")
sSql="select * from StuInfo where StuID in (select StuID from CourseSelectedInfo where CID='"&course&"')"
问题出在这两个地方
最简单的解决办法
course=Request.Form("course")
'在上面这句代码下面一行添加如下代码。
IF course<>"" Then
Session("course")=course
Else
course=Session("course")
End IF
2006-05-03 21:30
changhai_14
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-5-3
收藏
得分:0 

谢谢你.


2006-05-03 22:43
changhai_14
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-5-3
收藏
得分:0 

<!--#include file="..\inc\conn.asp"-->
<!--#include file="..\inc\SessionCheck.asp"-->
<%
Call DBConnBegin()
dim sc,scontent
sc=trim(request("sc"))
scontent=trim(request("scontent"))
sSql="select * from stuinfo "
select case sc
case "0"
sSql=sSql
case "1"
sSql=sSql&" where class like '%"&scontent&"%'"
case "2"
sSql=sSql&" where StuName like '%"&scontent&"%'"
end select
sSql=sSql&" order by id desc"
oRs.open sSql,oConn,1,1
%>

<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学生信息管理网站</title>
<link rel="stylesheet" href="..\inc\style.css" type="text/css">
</head>

<body topmargin="0" leftmargin="0">
<!--#include file="..\saCommonFile\pagehead.asp"-->
<table width="778" height="200" border="0" align="center">
<tr><td width="790" align=left>
<table width="776" height="35" cellspacing="0" cellpadding="0">
<td background="../images/top_1.jpg">&nbsp; <a href="doSelect.asp" class="link">选、退课处理</a>
| <a href="coursemanage.asp" class="link">课程信息处理</a>
| <a href="coursesearch.asp" class="link">选课信息查询</a></table>
<div align="center">
<center><form method="POST" action="doselect.asp">
<table border="0" width="700" cellspacing="0" cellpadding="0">
<tr><td align="right">选择查询条件:<select size="1" name="sc">
<option value="0" selected>全部</option>
<option value="1">班级</option>
<option value="2">学生姓名</option>
</select> 输入查询内容:<input type="text" name="sContent" size="20"> <input type="submit" value="查询" name="B1"></td></tr></table></form>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<%
if Not(oRs.bof and oRs.eof) then'判别数据表中是否为空记录
dim NumRecord,NumPage,NoncePage,i
NumRecord=oRs.recordcount
oRs.pagesize=10
NumPage=oRs.Pagecount
if request("page")=empty then
NoncePage=1
else
if Cint(request("page"))<1 then
NoncePage=1
else
NoncePage=request("page")
end if
if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
end if
else
NumRecord=0
NumPage=0
NoncePage=0
end if
%>
<table border="1" width="700" bordercolorlight="#000000" cellspacing="0" cellpadding="5" bordercolordark="#FFFFFF">
<tr>
<td width="71" bgcolor="#EBE9FE" align="center">学号</td>
<td width="78" bgcolor="#EBE9FE" align="center">姓名</td>
<td width="65" bgcolor="#EBE9FE" align="center">性别</td>
<td width="78" bgcolor="#EBE9FE" align="center">班级</td>
<td width="90" bgcolor="#EBE9FE" align="center">专业</td>
<td width="80" bgcolor="#EBE9FE" align="center">联系电话</td>
<td width="71" bgcolor="#EBE9FE" align="center">选课</td>
<td width="71" bgcolor="#EBE9FE" align="center">退选</td>
</tr>
<%if Not(oRs.bof and oRs.eof) then
oRs.move (Cint(NoncePage)-1)*10,1
for i=1 to oRs.pagesize
%>

<tr>
<td width="71" align="center"><%=oRs("StuID")%></td>
<td width="78" align="center"><%=oRs("StuName")%></td>
<td width="65" align="center"><%=oRs("Stusex")%></td>
<td width="78" align="center"><%=oRs("Class")%></td>
<td width="90" align="center"><%=oRs("Major")%></td>
<td width="80" align="center"><%=oRs("Tele")%></td>
<td width="71" align="center"><a href=toselect.asp?id=<%=oRs("id")%> class="link">选课</a></td>
<td width="71" align="center"><a href=todeselect.asp?id=<%=oRs("id")%> class="link">退选</a></td>
</tr>
<% oRs.movenext
if oRs.eof then exit for
next
else
response.write "<tr><td colspan=13><marquee scrolldelay=120 behavior=alternate>没有找到任何记录!!!</marquee></td></tr>"
end if

oRs.close
%>

</table>
</table>
<table width="776" border="0">
<tr><td height="17">
<div align="right">
<input type="hidden" name="page" value="<%=NoncePage%>">
<%
if NoncePage>1 then
response.write "|<a href=doselect.asp?page=1>首 页</a>| |<a href=doselect.asp?page="&NoncePage-1&">上一页</a>|&nbsp"
else
response.write "|首 页| |上一页|&nbsp"
end if
if Cint(Trim(NoncePage))<Cint(Trim(NumPage)) then
response.write "|<a href=doselect.asp?page="&NoncePage+1&">下一页</a>| |<a href=doselect.asp?page="&NumPage&">尾 页</a>|"
else
response.write "|下一页| |尾 页|"
end if
%>
&nbsp;页次:<font color="#0033CC"><%=NoncePage%></font>/<font color="#0033CC"><%=NumPage%></font>
共<font color="#0033CC"><%=NumRecord%></font>条记录&nbsp; </div>
</td></tr>
</table>
</center></div>
</td></tr></table>
<%Call DBConnEnd()%>
<!--#include file="..\saCommonFile\pagefoot.asp"-->
</body>
</html>

不好意思.在次请教.情况跟上面那个相似!!!


2006-05-03 22:51
changhai_14
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-5-3
收藏
得分:0 
IF sc<>"" and scontent<>""Then
Session("sc")=sc
Session(" scontent")= scontent
Else
sc=Session("sc")
scontent=Session(" scontent")
End IF
是不是加上这几句就行了.!!

2006-05-03 23:04
快速回复:查询后分页显示出问题.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012637 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved