| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1006 人关注过本帖
标题:[求助]ASP分页显示;只显示第一页
只看楼主 加入收藏
ASP汽车
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2007-7-4
收藏
 问题点数:0 回复次数:7 
[求助]ASP分页显示;只显示第一页

代码如下:红色部分为分页显示代码,大家帮我看看为什么我查询出来的结果只能显示第一页,点击后一页就是空白的
<%response.Buffer=true%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>需求单系统查询</title>
</head>
<!--#include file="conn.asp"-->
<script type="text/javascript" src="calendar.js"></script>

<form action="dispose_demand.asp" method="post" name="dispose_demand">
<table width="852" border="1" align="center">
<td colspan="4" class="titleClass">需求单系统查询画面</td>
<tr>
<td width="115" height="48">需求主旨:</td>
<td colspan="3"><label>
<input type="text" id="MAJOR_IDEA" name="MAJOR_IDEA" size="65" maxlength="65" />
</label></td>
</tr>
<tr>
<td height="43">需求单提出日期:</td>
<td width="305"><label>
<input onFocus="calendar()" name="APPLY_TIME_start" type="text" id="APPLY_TIME_start" />
</label></td>
<td width="87">至: </td>
<td width="317"><label>
<input onFocus="calendar()" name="APPLY_TIME_end" type="text" id="Calendar1" />
</label></td>
</tr>
<tr>
<td height="35">希望上线时间:</td>
<td><label>
<input onFocus="calendar()" name="WISH_FINISH_TIME_start" type="text" id="Calendar1" />
</label></td>
<td>至:</td>
<td><label>
<input onFocus="calendar()" name="WISH_FINISH_TIME_end" type="text" id="Calendar1" />
</label></td>
</tr>
<tr>
<td height="42">资讯主办:</td>
<td><label>
<input name="IT_UNDERTAKER" type="text" size="30" />
</label></td>
<td>需求状态:</td>
<td><label>
<select name="PHASE" >
<option selected="selected">请选择</option>
<option value="提单审核">提单审核</option>
<option value="效益评估">效益评估</option>
<option value="需求确认">需求确认</option>
<option value="系统分析">系统分析</option>
<option value="系统开发">系统开发</option>
<option value="系统测试">系统测试</option>
<option value="用户测试">用户测试</option>
<option value="达成目标">达成目标</option>
<option value="正式上线">正式上线</option>
</select>
</label></td>
</tr>
<tr>
<td height="41" colspan="4">查询条件选择
<label>
<input type="button" name="select1" value="查询" />
<input name="reset" type="button" onClick="show(); return false;" value="重置" />
</label></td>
</tr>
</table>
<%


dim MAJOR_IDEA,APPLY_TIME_start,APPLY_TIME_end,WISH_FINISH_TIME_start,WISH_FINISH_TIME_end,IT_UNDERTAKER,PHASE

MAJOR_IDEA=Trim(request.form("MAJOR_IDEA"))
APPLY_TIME_start=Trim(request.form("APPLY_TIME_start"))
APPLY_TIME_end=Trim(request.form("APPLY_TIME_end"))
WISH_FINISH_TIME_start=Trim(request.form("WISH_FINISH_TIME_start"))
WISH_FINISH_TIME_end=Trim(request.form("WISH_FINISH_TIME_end"))
IT_UNDERTAKER=Trim(request.form("IT_UNDERTAKER"))
PHASE=Trim(request.form("PHASE"))
Dim Rs,Sql
Set Rs = server.CreateObject("Adodb.Recordset")
if request("flag")="Q" then
sql="select APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO where 1=1"

if len(MAJOR_IDEA)>0 then
sql=sql &" and MAJOR_IDEA like '%"& MAJOR_IDEA &"%'"
end if

if len(APPLY_TIME_start)>1 then
sql=sql &" and APPLY_TIME >='"& APPLY_TIME_start &"'"
end if

if len(APPLY_TIME_end)>1 then
sql=sql&" and APPLY_TIME <='"& APPLY_TIME_end &"'"
end if


if len( WISH_FINISH_TIME_start)>1 then
sql=sql&" and WISH_FINISH_TIME >='"& WISH_FINISH_TIME_start &"'"
end if

if len(WISH_FINISH_TIME_end)>1 then
sql=sql&" and APPLY_TIME <='"& WISH_FINISH_TIME_end &"'"
end if

if len(IT_UNDERTAKER)>1 then
sql=sql&" and IT_UNDERTAKE = '"& IT_UNDERTAKE &"'"
end if

if len(PHASE)>3 then
sql=sql&" and PHASE='"& PHASE &"'"
end if
sql=sql&"order by APPLY_TIME desc"
Rs.open SQL,CONN,1,1
Dim RowCount
RowCount = 3 '每页显示的记录条数
Dim TotalPage '总页数
Dim PageNo '当前显示的是第几页
'Dim RecordC '总记录条数
Rs.PageSize = RowCount
RecordC = Rs.RecordCount
TotalPage =INT(RecordC/PageSize * -1)*-1
'TotalPage =2
PageNo = Request.QueryString ("PageNo")
'直接输入页数跳转;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果没有选择第几页,则默认显示第一页;
If PageNo = "" then PageNo = 1
If RecordC <> 0 then
Rs.AbsolutePage = PageNo
End If

'获取当前文件名,使得每次翻页都在当前页面进行;
'Dim fileName,postion
'fileName = Request.ServerVariables("script_name")
'postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
'fileName = Mid(fileName,postion)

%>
</tr>
</table>
<p>&nbsp;</p>
<tr><td colspan=4 width="600" height="10"><input name=flag type=hidden value=""> </td></tr>
<table border=0 width='100%'>
<tr>
<td align=left> 总页数:<font color=#ff3333><%=TotalPage%></font>页
当前第<font color=#ff3333><%=PageNo%></font>页</td>
<td align="right">
<%If TotalPage = 1 Then
Response.Write "首页|前页|后页|末页"
Else%>
<a href="?PageNo=1">首页|</a>
<%If PageNo - 1 = 0 Then
Response.Write "前页|"
Else%>
<a href="?PageNo=<%=PageNo-1%>">前页|</a>
<%End If

If PageNo+1 > TotalPage Then
Response.Write "后页|"
Else%>
<a href="?PageNo=<%=PageNo+1%>">后页|</a>
<%End If%>

<a href="?PageNo=<%=TotalPage%>">末页</a>
<%End If%></td>
<td width=95>转到第
<%If TotalPage = 1 Then%>
<input type=text name=PageNo size=3 readonly disabled style="background:#d3d3d3">
<%Else%>
<input type=text name=PageNo size=3 value="" title=请输入页号,然后回车>
<%End If%>页</td>
</tr>
</table>

<TABLE cellPadding=1 align="center" cellSpacing=1 border=1 width="1000" height="1" >
<%
response.write"<tr>"
response.write"<td width=100> 需求单位 </td>"
response.write"<td width=100> 需求提出人 </td>"
response.write"<td width=100> 主旨 </td>"
response.write"<td width=100> 资讯主办 </td>"
response.write"<td width=100> 需求提出日期</td>"
response.write"<td width=100> 希望上线日期 </td>"
response.write"<td width=100> 预估完成日期 </td>"
response.write"<td width=100> 状态</td>"
response.write"<td width=100> 说明</td></tr>"
if not rs.eof then
'Rs.MoveFirst

Do while Not rs.Eof and RowCount>0

nAPPLY_DEPARTMENT=trim(rs.fields("APPLY_DEPARTMENT"))
nAPPLIER=trim(rs.fields("APPLIER"))
nMAJOR_IDEA=trim(rs.fields("MAJOR_IDEA"))
nIT_UNDERTAKER=trim(rs.fields("IT_UNDERTAKER"))
nAPPLY_TIME=trim(rs.fields("APPLY_TIME"))
nWISH_FINISH_TIME=trim(rs.fields("WISH_FINISH_TIME"))
nTOTESTTIME=trim(rs.fields("TOTESTTIME"))
nPHASE=trim(rs.fields("PHASE"))


response.write"<tr>"
response.write"<td width=100>" & nAPPLY_DEPARTMENT & "</td>"
response.write"<td width=100>" & nAPPLIER & "</td>"
response.write"<td width=100>" & nMAJOR_IDEA & "</td>"
response.write"<td width=100>" & nIT_UNDERTAKER & "</td>"
response.write"<td width=100>" & nAPPLY_TIME & "</td>"
response.write"<td width=100>" & nWISH_FINISH_TIME & "</td>"
response.write"<td width=100>" & nTOTESTTIME & "</td>"
response.write"<td width=100>" & nPHASE & "</td></tr>"
RowCount = RowCount - 1
Rs.MoveNext
Loop
else
response.Write("需求单不存在")
end if
end if
'Rs.close
%>

</table>
</form>
</body>
</html>

<script language="vbscript">
dispose_demand.MAJOR_IDEA.value="<%=MAJOR_IDEA%>"
dispose_demand.APPLY_TIME_start.value="<%=APPLY_TIME_start%>"
dispose_demand.APPLY_TIME_end.value="<%=APPLY_TIME_start%>"
dispose_demand.WISH_FINISH_TIME_start.value="<%=WISH_FINISH_TIME_start%>"
dispose_demand.WISH_FINISH_TIME_end.value="<%=WISH_FINISH_TIME_end%>"

dispose_demand. IT_UNDERTAKER.value="<%= IT_UNDERTAKER%>"
dispose_demand.PHASE.value="<%=PHASE%>"
</script>


<script language="vbscript" >
sub select1_onclick
if dispose_demand.MAJOR_IDEA.value="" and dispose_demand.APPLY_TIME_start.value="" and dispose_demand.APPLY_TIME_end.value="" and dispose_demand.WISH_FINISH_TIME_start.value="" and dispose_demand.WISH_FINISH_TIME_end.value="" and dispose_demand.IT_UNDERTAKER.value="" and dispose_demand.PHASE.value="" then
MsgBox "查询条件不能为空,至少需要输入一个查询条件!",78,"需求单系统查询"
dispose_demand.MAJOR_IDEA.focus
exit sub
end if

dispose_demand.flag.value="Q"
dispose_demand.submit
end sub
</script>


<script>
function show()
{
window.document.dispose_demand.MAJOR_IDEA.value=""
window.document.dispose_demand.APPLY_TIME_start.value=""
window.document.dispose_demand.APPLY_TIME_end.value=""
window.document.dispose_demand.WISH_FINISH_TIME_start.value=""
window.document.dispose_demand.WISH_FINISH_TIME_end.value=""
window.document.dispose_demand.IT_UNDERTAKER.value=""
window.document.dispose_demand.PHASE.value=""
}
</script>


<%
set Rs=nothing
Conn.close
Set Conn=nothing
%>

搜索更多相关主题的帖子: ASP 
2007-07-19 20:18
udbyygy
Rank: 1
等 级:新手上路
威 望:2
帖 子:226
专家分:0
注 册:2007-6-26
收藏
得分:0 
PageNo = Request.QueryString ("PageNo")/1  '除1后看看好了不,加0也行,很多人都翻这错喔

[此贴子已经被作者于2007-7-19 20:57:57编辑过]



2007-07-19 20:56
jtj123456
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2007-7-18
收藏
得分:0 

我也是这中错误,正在解决中

2007-07-20 11:23
jtj123456
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2007-7-18
收藏
得分:0 
回复:(ASP汽车)[求助]ASP分页显示;只显示第一页
你的分页问题解决了没有啊,如果是,怎么解决的啊
2007-07-20 16:46
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
把查询条件也加到翻页里面,估计不加应该显示数据库里的所有内容。
2007-07-20 17:03
jtj123456
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2007-7-18
收藏
得分:0 
回复:(madpbpl)把查询条件也加到翻页里面,估计不加...

是的,可是怎么加呢?
查询两个日期中的信息:

从两个下拉列表中选择两个年份
r_year6=request.form("select6")
r_year5=request.form("select5")

我的sql语句是:sql="select year(datetime) ,sum(r_sum) as 总金额 from table1 where date_year between '"&r_year5&"'and '"&r_year6&"' group by year(datetime) "

应该怎么写下一页的URL呢?

是这样的吗:[http://localhost/admin/showStatistic2.asp?r_year5=2001&r_year6=2008&page=2]

2007-07-20 17:11
rtc
Rank: 2
等 级:新手上路
威 望:4
帖 子:590
专家分:0
注 册:2007-6-6
收藏
得分:0 
我自己有一种新分页方法, 超简单.
一个
rs.pagesiez=5 定义每页
rs.pagecount 总多少要.
rs.absolutepage=page
If page>rs.pagecount Then page=rs.pagecount
rs.recordcount全部记录.
就可以阿
2007-07-20 17:22
jtj123456
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2007-7-18
收藏
得分:0 
回复:(rtc)我自己有一种新分页方法, 超简单.一个rs...

那有没有带查询的分页方法呢,就是上面我举的那个例子啊,如何写啊

2007-07-20 17:33
快速回复:[求助]ASP分页显示;只显示第一页
数据加载中...
 
   



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

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