| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 734 人关注过本帖
标题:关于一个翻页的问题
取消只看楼主 加入收藏
daring
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2006-7-12
收藏
 问题点数:0 回复次数:4 
关于一个翻页的问题
我做的查询时,执行程序的时候里面显示的是共3页,且显示了第一页,但我点击下一页的时候,却没有一条记录

搜索更多相关主题的帖子: 查询 
2006-10-11 11:52
daring
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2006-7-12
收藏
得分:0 
<html>
<head>
<title>考勤数据</title>
</head>

<script language="vbscript" >
sub b_find_onclick
window.navigate "findattendinfo.asp"
end sub
</script>

<body>
<div align="center">

<% if session("s_username")<> "" then %>

<caption><b>考勤数据</b></caption>


<form name="f_find" method="post" action="findattendinfo.asp">
<table bgcolor="#cceeff">
<tr>
<td align="right">员工姓名:</td>
<td><input type="text" name="t_name" size="10">&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>员工号:</td>
<td><input type="text" name="t_oved" size="10"></td>
<td>至</td>
<td><input type="text" name="t_oved1" size="10"></td>
<td><input type="submit" name="b_find" value="查询" style="{width: 80px}"></td></tr>
<tr>
<td>刷卡类型:</td>
<td><select size="1" name="s_attend" style="{width: 80px}">
<option value="all"></option>
<option value="上班">上班</option>
<option value="下班">下班</option>
<option value="上午下班">上午下班</option>
<option value="下午上班">下午上班</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>刷卡日期:</td>
<td><input type="text" name="t_date" size="10"></td>
<td>至</td>
<td><input type="text" name="t_date1" size="10"></td>
<td colspan="2" align="center"><input type="reset" value="全部重写">
</tr>
</table>
</form>


<%
dim cnn,rst,s_sql,currentpage,rowcount,i,s_sql1
dim s_name,s_oved,s_oved1,s_attend1,s_date,s_date1
dim s_ovedno

s_name=request.form("t_name")
s_oved=request.form("t_oved")
s_oved1=request.form("t_oved1")
s_attend1=request.form("s_attend")
s_date=request.form("t_date")
s_date1=request.form("t_date1")

currentpage=request.querystring("currentpage")

if currentpage="" then
currentpage=1
end if

set cnn=server.createobject("adodb.connection")
set rst=server.createobject("adodb.recordset")
cnn.connectionstring="driver={sql server};server=xiaozhen;uid=sa;pwd=sa;database=findsystem"
cnn.open



if s_name="" then

else
if s_sql="" then
s_sql=" where 姓名 like '%" & s_name & "%'"
else
s_sql=s_sql & " or 姓名 like '%" & s_name & "%'"
end if
end if

if s_attend1="" then

else
if s_sql="" then
s_sql=" where 刷卡类型 ='" & s_attend1 & "'"
else
s_sql=s_sql & " or 刷卡类型 ='" & s_attend1 & "'"
end if
end if

if s_oved="" and s_oved1="" then

else
if s_sql="" then
s_sql=" where 员工号 >='" & s_oved & "' and 员工号<='" & s_oved1 & "'"
else
s_sql=s_sql & " or 员工号 >='" & s_oved & "' and 员工号<='" & s_oved1 & "'"
end if
end if


if s_date="" and s_date1="" then

else
if s_sql="" then
s_sql=" where 刷卡日期 >='" & s_date & "' and 刷卡日期 <='" & s_date1 & "'"
else
s_sql=s_sql & " or 刷卡日期 >='" & s_date & "' and 刷卡日期 <='" & s_date1 & "'"
end if
end if

rst.cursortype=adopenstatic
rst.pagesize=10
s_sql="select * from kaoqin" & s_sql
rst.open s_sql,cnn,1,1


if rst.recordcount=0 then
else
rst.absolutepage=cint(currentpage)
l_rowcount=0
%>


<table align="center" border="1">
<tr bgcolor="#99ccff">
<td align="center">员工号</td>
<td align="center">姓名</td>
<td align="center">卡号</td>
<td align="center">刷卡类型</td>
<td align="center">刷卡日期</td>
<td align="center">刷卡时间</td>
</tr>

<%
while not rst.eof and l_rowcount < rst.pagesize
%>

<tr>
<% for l_i=0 to rst.fields.count - 1 %>
<% if l_i=0 then %>
<td nowrap ><a href="<% =url %>/attend/ovedinfo1.asp?ovedno=<% = rst(l_i) %>"><% =rst(l_i) %></a></td>
<% else %>
<td nowrap align="center" width="90"><% = rst(l_i) %></td>
<% end if %>

<% next %>
</tr>

<%
l_rowcount=l_rowcount + 1
rst.movenext
wend
end if
%>
</table>
<h5><p>共<% =rst.pagecount %>页&nbsp;当前页:<% =currentpage %>/<% =rst.pagecount %>&nbsp;&nbsp;
<%
if currentpage > 1 then
Response.Write "<A href = findattendinfo.asp?currentpage=" & (currentpage - 1) & ">[上一页]</a>"
end if
%>
&nbsp;
<%
if not rst.eof then
Response.Write "<A href = findattendinfo.asp?currentpage=" & (currentpage + 1) & ">[下一页]</a>"
end if
%>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="<% =url %>/login/host.asp">返回</a>&nbsp;&nbsp;
</p>
</h5>
<%
else
response.redirect "/default.asp" %>
<% end if %>
</div>
</body>
</html>



2006-10-11 16:24
daring
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2006-7-12
收藏
得分:0 
谢谢楼主的帮助,我的问题现在还是没有解决,有点闷,以上的方法我都试过啦,都不行,当点下一页的时候,程序把所有的查询条件都置空啦,怎么样才能把查询条件保存起来,小弟把这个查询做成两个页面,一个放查询页,一个放结果,把form下的所有对象都设为
session("s_oved")这样的形势,但也是不行的,唉,好烦啊
2006-10-12 09:30
daring
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2006-7-12
收藏
得分:0 

谢谢你,我照你的方法做了,但又有新的问题出来啦

错误类型:
ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/attend/findattendinfo.asp, 第 125 行



<html>
<head>
<title>考勤数据</title>
</head>

<script language="vbscript" >
sub b_find1_onclick
window.navigate "findattendinfo.asp"
end sub
</script>

<body>
<div align="center">

<% if session("s_username")<> "" then %>

<caption><b>考勤数据</b></caption>


<form name="f_find" method="post" action="findattendinfo.asp">
<table bgcolor="#cceeff">
<tr>
<td align="right">员工姓名:</td>
<td><input type="text" name="t_name" size="10">&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>员工号:</td>
<td><input type="text" name="t_oved" size="10"></td>
<td>至</td>
<td><input type="text" name="t_oved1" size="10"></td>
<td><input type="submit" name="b_find" value="查询" style="{width: 80px}"></td></tr>
<tr>
<td>刷卡类型:</td>
<td><select size="1" name="s_attend" style="{width: 80px}">
<option value=""></option>
<option value="上班">上班</option>
<option value="下班">下班</option>
<option value="上午下班">上午下班</option>
<option value="下午上班">下午上班</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>刷卡日期:</td>
<td><input type="text" name="t_date" size="10"></td>
<td>至</td>
<td><input type="text" name="t_date1" size="10"></td>
<td colspan="2" align="center"><input type="reset" value="全部重写">
</tr>
</table>
</form>


<%
dim cnn,rst,s_sql,currentpage,rowcount,i,s_sql1
dim s_name,s_oved,s_oved1,s_attend1,s_date,s_date1
dim s_ovedno

s_name=request("t_name")
s_oved=request("t_oved")
s_oved1=request("t_oved1")
s_attend1=request("s_attend")
s_date=request("t_date")
s_date1=request("t_date1")

currentpage=request.querystring("currentpage")

if currentpage="" then
currentpage=1
end if

set cnn=server.createobject("adodb.connection")
set rst=server.createobject("adodb.recordset")
cnn.connectionstring="driver={sql server};server=xiaozhen;uid=sa;pwd=sa;database=findsystem"
cnn.open


if s_name="" then

else
if s_sql="" then
s_sql=" where 姓名 like '%" & s_name & "%'"
else
s_sql=s_sql & " or 姓名 like '%" & s_name & "%'"
end if
end if

if s_attend1="" then

else
if s_sql="" then
s_sql=" where 刷卡类型 ='" & s_attend1 & "'"
else
s_sql=s_sql & " or 刷卡类型 ='" & s_attend1 & "'"
end if
end if

if s_oved="" and s_oved1="" then

else
if s_sql="" then
s_sql=" where 员工号 >='" & s_oved & "' and 员工号<='" & s_oved1 & "'"
else
s_sql=s_sql & " or 员工号 >='" & s_oved & "' and 员工号<='" & s_oved1 & "'"
end if
end if


if s_date="" and s_date1="" then

else
if s_sql="" then
s_sql=" where 刷卡日期 >='" & s_date & "' and 刷卡日期 <='" & s_date1 & "'"
else
s_sql=s_sql & " or 刷卡日期 >='" & s_date & "' and 刷卡日期 <='" & s_date1 & "'"
end if
end if

rst.cursortype=adopenstatic
rst.pagesize=10

s_sql1="select * from kaoqin" & s_sql

rst.open s_sql1,cnn,1,1

response.write s_sql1

if rst.eof then
else
rst.absolutepage=cint(currentpage)
l_rowcount=0
%>


<table align="center" border="1">
<tr bgcolor="#99ccff">
<td align="center">员工号</td>
<td align="center">姓名</td>
<td align="center">卡号</td>
<td align="center">刷卡类型</td>
<td align="center">刷卡日期</td>
<td align="center">刷卡时间</td>
</tr>

<%
while not rst.eof and l_rowcount < rst.pagesize
%>

<tr>
<% for l_i=0 to rst.fields.count - 1 %>
<% if l_i=0 then %>
<td nowrap ><a href="<% =url %>/attend/ovedinfo1.asp?ovedno=<% = rst(l_i) %>"><% =rst(l_i) %></a></td>
<% else %>
<td nowrap align="center" width="90"><% = rst(l_i) %></td>
<% end if %>

<% next %>
</tr>

<%
l_rowcount=l_rowcount + 1
rst.movenext
wend
end if
%>
</table>
<h5><p>共<% =rst.pagecount %>页&nbsp;当前页:<% =currentpage %>/<% =rst.pagecount %>&nbsp;&nbsp;
<%
if currentpage > 1 then
Response.Write "<A href = findattendinfo.asp?currentpage="&(currentpage - 1)&"&t_name="&s_name&"&t_oved="&s_oved&"&t_oved1="&s_oved1&"&t_attend="&s_attend&"&t_date="&s_date&"&t_date1="&s_date1&">[上一页]</a>"
end if
%>
&nbsp;
<%
if not rst.eof then
Response.Write "<A href = findattendinfo.asp?currentpage="&(currentpage - 1)&"&t_name="&s_name&"&t_oved="&s_oved&"&t_oved1="&s_oved1&"&t_attend="&s_attend&"&t_date="&s_date&"&t_date1="&s_date1&">[下一页]</a>"
end if
%>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="<% =url %>/login/host.asp">返回</a>&nbsp;&nbsp;
</p>
</h5>
<%
else
response.redirect "/default.asp" %>
<% end if %>
</div>
</body>
</html>

2006-10-12 11:02
daring
Rank: 1
等 级:新手上路
帖 子:60
专家分:0
注 册:2006-7-12
收藏
得分:0 
问题终于解决啦,谢谢大家的帮助
2006-10-12 13:03
快速回复:关于一个翻页的问题
数据加载中...
 
   



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

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