| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 805 人关注过本帖
标题:[求助]按时间段搜索后分页出错
只看楼主 加入收藏
wwwsensen
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2005-10-31
收藏
 问题点数:0 回复次数:3 
[求助]按时间段搜索后分页出错

程序地址:www.kinets.com/gongpiao
查询的时候不选择时间段没有问题,选择时间段查询后显示正常,但点下一页往后翻页的时候出现的结果确是全部时间段的数据。
我实在是搞不懂问题出在哪了,望知道的GG、JJ指点一下。
下面的是代码

<!--#include file="conn.asp"-->
<html><head><title>工票管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="form2" method="post" action="user01manage.asp">
<div align="center">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<div align="center">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
<tr>
<td height="30" align="center" bgcolor="#CCCCCC">工票状态:
<select size="1" name="ztname" style="width:65">
<%
set ztrs=conn.execute("select * from zhuanti order by ztorder")
do while not ztrs.eof
%>
<option selected value=<%=ztrs("ztname")%>><%=ztrs("ztname")%></option>
<%
ztrs.movenext
loop
set ztrs=nothing
%>
</select>
起始:
<select name="year1" size="1">
<%for i=2006 to year(date())%>
<option value="<%=i%>"><%=i%> </option>
<%next%>
</select>

<select name="month1" size="1">
<option value="01" selected>01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>

<select name="day1" size="1">
<option value=01 selected>01</option>
<option value=02>02</option>
<option value=03>03</option>
<option value=04>04</option>
<option value=05>05</option>
<option value=06>06</option>
<option value=07>07</option>
<option value=08>08</option>
<option value=09>09</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
日&nbsp;&nbsp;截至:
<select name="year2" size="1">
<%for i=2006 to year(now())%>
<option value="<%=i%>" <%if year(now())=i then%>selected<%end if%>><%=i%></option>
<%next%>
</select>

<select name="month2">
<% if month(date())<10 then %>
<option selected value="0<%=month(date())%>">0<%=month(date())%>
<%else%>
<option selected value="<%=month(date())%>"><%=month(date())%>
<%end if%>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>

<select name="day2">
<% if day(date())<10 then %>
<option selected value="0<%=day(date())%>">0<%=day(date())%>
<%else%>
<option selected value="<%=day(date())%>"><%=day(date())%>
<%end if%>
<option value=01>01</option>
<option value=02>02</option>
<option value=03>03</option>
<option value=04>04</option>
<option value=05>05</option>
<option value=06>06</option>
<option value=07>07</option>
<option value=08>08</option>
<option value=09>09</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
工票号:
<input name="keyword" type="text" id="keyword" size="5"> <input type="submit" name="Submit" value="查 询">
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td height="25" background="bg1.gif"><table width="800" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
<%'开始分页
Const MaxPerPage=6
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Request("page")<>"" then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from soft where aaa=0 "
ztname=trim(request("ztname"))
keyword=trim(request("keyword"))
startdate=Request("year1")&Request("month1")&Request("day1")
enddate=Request("year2")&Request("month2")&Request("day2")
scontent=request("scontent")
if ztname<>"" then
if ztname<>"0" then
sql=sql&" and ztname like '%"&ztname&"%'"
end if
end if

if startdate<>"" then
sql=sql&" and fdate>="&startdate
end if

if enddate<>"" then
sql=sql&" and fdate<="&enddate
end if
if keyword<>"" then

sql=sql&" and scontent like '%"&keyword&"%' "

end if
sql=sql&" order by fdate desc "
rs.open sql,conn,1,1
if err.number<>0 then
response.write "暂无符合条件的工票!"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center' > 暂无符合条件的工票!</p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"user01manage.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"user01manage.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"user01manage.asp"
end if
end if
end if

sub showContent
dim i
i=0%>
<%do while not rs.eof%>
<tr>
<td width="800" height="15"><table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td bgcolor="#FFFFFF">编号:<%=rs("newsnum")%> 工票状态:<%=rs("ztname")%> 完成时间:<%=rs("fdate")%></td>
</tr>
</table></td>
</tr>
<tr>
<td height="15" align="right" bgcolor="#CCCCCC"> <font size="2"><b>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
<font color="#0000FF"> </font> </b>
<%
End Sub

Function showpage(totalnumber,maxperpage,filename)
Dim n

If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
Response.Write "<p align='center' > "
If CurrentPage<2 Then
Response.Write "<font size=2>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1"&"&ztname=" & ztname & "&startdate=" & startdate & "&enddate=" & enddate & "&keyword="& keyword & "&scontent=" & scontent & " >首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&ztname=" & ztname & "&startdate=" & startdate & "&enddate=" & enddate & "&keyword="& keyword & "&scontent=" & scontent & " >上一页</a> "
End If

If n-currentpage<1 Then
Response.Write "<font size=2>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)& "&ztname=" & ztname & "&startdate=" & startdate & "&enddate=" & enddate & "&keyword="& keyword & "&scontent=" & scontent & ">"
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&ztname=" & ztname & "&startdate=" & startdate & "&enddate=" & enddate & "&keyword="& keyword & "&scontent=" & scontent & ">尾页</a>"
End If
Response.Write "<font size=2> 页次:</font><font size=2>"&CurrentPage&"</font><font size=2>/"&n&"页</font> "
End Function
%>
<b> </b> </font></td>
</tr>
</table></td>
</tr>
</table>
</form>
</td>
</body>
</html>

搜索更多相关主题的帖子: 时间段 搜索 title css 
2006-04-21 15:58
zfjyyzycl
Rank: 2
等 级:论坛游民
帖 子:239
专家分:10
注 册:2006-4-15
收藏
得分:0 
大体看了看,好像你选择的参数传递不成功
除了工票的状态传递了,其他的参数传递不成功


<a href=default.asp?page=13&ztname=完成&startdate=&enddate=&keyword=&scontent= >上一页</a>
除了工票的状态传递过来,其他的全部是空的

另外 工票的状态虽然传递了,但是传递的 是 完成 不是已完成
作为 like 条件 已完成 和 未完成 都包括 完成,再加上其它的条件为空
当然 查到全部记录了 !
2006-04-21 22:51
wwwsensen
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2005-10-31
收藏
得分:0 
是开始日日期和截至日期传递不正确,应该是大于等于开始日期,小于等于截至日期吧,可是怎样来改呢??

===为了明天更美好我们一起来学习===
2006-04-22 09:00
wwwsensen
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2005-10-31
收藏
得分:0 

顶起来啊!!没人知道吗/?


===为了明天更美好我们一起来学习===
2006-04-22 13:01
快速回复:[求助]按时间段搜索后分页出错
数据加载中...
 
   



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

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