急急急急急求助:时间范围查询,并且实现结果分页显示出来

rain520 2006-03-28 01:55:53
急急急急急求助:时间范围查询,并且实现结果分页显示出来。
请各位高手帮帮忙。
...全文
98 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
rain520 2006-03-28
  • 打赏
  • 举报
回复
谢谢各位高手参与。偶的查询数据库没问题哦
只是点击下一页就出现错误而已。偶想是不是分页这个页面没有设置传递参数?该怎样传递?
因为是一个时间范围而不固定。才难倒了我~~~~该怎样弄咯?
quanzi0214 2006-03-28
  • 打赏
  • 举报
回复
我的分页是这样的,不知要加什么参数才可以实现时间范围查询的分页:
人家的重点是时间段查询,
呵呵分页人家已经做了
纪俊 2006-03-28
  • 打赏
  • 举报
回复
搜索分页有很多例子。。就是用Recordset对象的属性.pagesize等几个属性来实现,很容易
quanzi0214 2006-03-28
  • 打赏
  • 举报
回复
WHERE 数据库日期字段 BETWEEN 开始日期 AND 结束日期



BETWEEN
指定测试范围。

语法
test_expression [ NOT ] BETWEEN begin_expression AND end_expression

参数
test_expression

是用来在由 begin_expression 和 end_expression 定义的范围内进行测试的表达式。test_expression 必须与 begin_expression 和 end_expression 具有相同的数据类型。

NOT

指定谓词的结果被取反。

begin_expression

是任何有效的 Microsoft® SQL Server™ 表达式。begin_expression 必须与 test_expression 和 end_expression 具有相同的数据类型。

end_expression

是任何有效的 SQL Server 表达式。end_expression 必须与 test_expression 和 begin_expression 一样具有相同的数据类型。

AND

作为一个占位符,表示 test_expression 应该处于由 begin_expression 和 end_expression 指定的范围内。

sky0120 2006-03-28
  • 打赏
  • 举报
回复
UP
rain520 2006-03-28
  • 打赏
  • 举报
回复
我的分页是这样的,不知要加什么参数才可以实现时间范围查询的分页:
--------包含文件 showlist.asp-------
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->
</script>
<%
sub showlist(rs)
if not rs.eof then
page=clng(request.QueryString("page"))
rs.pagesize=15
if page=empty then page=1
pc=rs.pagecount
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.absolutepage=cint(page)

if Purl=empty then
Purl=request.ServerVariables("PATH_INFO")
end if


response.Write("<table width='98%' border=4 align=center cellpadding=3 cellspacing=1 bordercolor=#0066aa class='tdb'>")
response.Write("<tr bgcolor=#0099cc style='color=ffffff' height=30>")

for i = 1 to rs.fields.count-14
if RS.fields(i).name="peoidname" then
view="姓名"
end if
if rs.fields(i).name="peono" then
view="编号"
end if
if rs.Fields(i).name="peosex" then
view="性别"
end if
if rs.fields(i).name="peoaddr" then
view="户籍所在地"
end if
if rs.fields(i).name="peoidno" then
view="身份证号码"
end if
if rs.fields(i).name="peounit" then
view="来访单位"
end if
if rs.fields(i).name="peoReason" then
view="访问原因"
end if
if rs.fields(i).name="intervieweeDept" then
view="访问部门"
end if
if rs.fields(i).name="Indate" then
view="进时间"
end if

response.Write("<td align=center>"&view&"</td>")

next



response.Write("</tr>")
For i =1 to rs.pagesize
ino=(page-1)*rs.pagesize+i+1
response.Write "<tr bgcolor=#0099cc>"
for j = 1 to rs.fields.count-14

if rs(j)="" then
response.Write "<td align=center> </td>"
else
response.Write "<td align=center>"&rs(j)&"</td>"


end if
next

response.Write("</tr>")
rs.movenext
if rs.eof then exit For
Next
response.Write("</table>")
%>
<form name=showlist id=showlist method=get>
<center>
<%
session("ispage")=true
if page<>1 then
%>
<a href="<%=Purl%>?page=1">第一页</a>
<a href="<%=Purl%>?page=<%=page-1%>">上一页</a>
<%
else
%>
<a href="#">第一页</a>
<a href="#">上一页</a>
<%
end if
if page <>rs.pagecount then
%>
<a href="<%=Purl%>?page=<%=page+1%>">下一页</a>
<a href="<%=Purl%>?page=<%=rs.pagecount%>">最末页</a>
<%
else
%>
<a href="#">下一页</a>
<a href="#">最末页</a>
<%
end if
response.Write " <font style='font-size: 12px;' color=red>第"&page&"页/共"&rs.pagecount&"页   </font><font color=>共</font><font color=red >"&rs.recordcount&"</font><font color=>条记录</font></font>"
response.Write "   <span class=style1>跳到</span>"
%>
<select name=page onChange="MM_jumpMenu('parent',this,1)">
<%
for i = 1 to rs.pagecount

%>

<option value=<%=Purl%>?page=<%=i%>><%=i%></option>
<%

next
%>
</select>页
<input type="button" name="Button1" value="前往" onClick="MM_jumpMenuGo('page','parent',1)">
</form>

<%

end if
end sub
%>

------------------- riqichaxun.asp ----------------------
<!-- #include file="conn.asp" -->
<!-- #include file="showlist.asp" -->
<html>
<head>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="riqichaxun.asp">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td bgcolor="#CCCCCC">时间从
<input name="bdate" type="text" size="10" maxlength="15"> 至
<input name="edate" type="text" size="10" maxlength="15"> <input type="submit" name="subm" value="查询"></td>
</tr>
</table>
</form></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <div align="center">
<%
bdate=request("bdate")
edate=request("edate")
set rs=server.createobject("ADODB.Recordset")
sql="select * from passlist where passdate between '"&bdate&"' and '"edate"'"
rs.open sql,conn,3,3
if not rs.eof then
Showlist rs

else
response.Write "<P><font face=幼圆 size=3>没有符合您要求查询的结果!</font>"
end if
%>
</div> </td>
</tr>
</table>

</body>
</html>


----------- conn.asp -------------
<%
set conn=server.CreateObject("adodb.connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq="& server.MapPath("dates.mdb")
%>

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧