标题:我是一个新手,请各位高手帮忙!
取消只看楼主
lsmmh
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2017-5-31
结帖率:100%
 问题点数:0 回复次数:1 
我是一个新手,请各位高手帮忙!
怎么才能实现查询时间段内的其中一个单位所有统计情况(如:查询A单位:2017—5-15至2017-5-31之间所有统计情况或查询A单位:2017—5-1至2017-5-20之间所有统计情况等)
  cwtj  表名  wbmc 时间字段   tel 单位名称字段

<style>
*{font-size:14px;}
* a{font-size:14px;}
</style>
<head>
<style>a{TEXT-DECORATION:none}</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>统计查询</title>
</head>
<!--#include file="../Select_date.asp"-->
<!--#include file="../conna.asp"-->
<!--#include file="cdlm.asp"-->
<%
sql88="select * from cwtj where "

if trim(request("wbmc"))<>"" then
sql88= sql88 & "wbmc like '%"&trim(request("wbmc"))&"%' and "
end if

if trim(request("tel"))<>"" then
sql88= sql88 & "tel like '%"&trim(request("tel"))&"%' and "
end if



sql88= sql88 & " 1=1 "

set rs88=server.createobject("adodb.recordset")
rs88.PageSize = 10 '这里设定每页显示的记录数
rs88.CursorLocation = 3
rs88.Open sql88,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs88.PageCount then
intpage = rs88.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs88.eof then
rs88.AbsolutePage = intpage
end if
%>

<form action="search.asp" method="post" name="form1">

<table width="650" border="1" cellpadding="0" cellspacing="0" align="center">
</tr>
<td height="20" align="center" colspan="4">查询条件(<font color="#0000FF">填写日期和单位名称精确查询:支持模糊查询</font>)</td>
</tr>

<tr bgcolor="#F2E1CC" >

<td height="20" align="center" width="320">开始日期<input type="text" name="wbmc" onFocus="CalendarWebControl.show(this,false,this.value);" size="12" /> </td>
<td height="20" align="center" width="320">结束日期<input type="text" name="wbmc" onFocus="CalendarWebControl.show(this,false,this.value);" size="16" /> </td>

<td height="20" align="center" width="320">单位名称<input type="text" name="tel" size="19" /> </td>
</tr>
</tr>

</tr>

</tr>
<td height="20" align="center" colspan="4"><input type="submit" name="submit" value="点击查询" /></td>
</tr>
</table>

<hr align="center" width="650">

<table width="650" border="1" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="21" align="center" width="42">序号</td>
<td height="21" align="center" width="89">统计日期</td>
<td height="21" align="center" width="106">单位名称</td>
<td height="21" align="center" width="124">文件签收</td>
<td height="21" align="center" width="109">开会学习情况</td>
<td height="21" align="center" width="181">统计情况</td>
</tr>
<%
if rs88.recordcount>0 then

for i=1 to rs88.PageSize
if rs88.EOF or rs88.BOF then exit for
%>

<tr>
<td height="24" align="center" width="42"><%=((intpage-1)*rs.pagesize+i)%></td>
<td height="24" align="center" width="89"><%=rs88("wbmc")%></td>
<td height="24" align="left" width="106"><%=rs88("tel")%></td>
<td height="24" align="left" width="124"><%=rs88("addressa")%></td>
<td height="24" align="left" width="109"><%=rs88("addresss")%></td>
<td height="24" align="left" width="181"><font size="2" color="#FF0000"><%=rs88("addressd")%></font></td>
</tr>

<%
rs88.movenext
next

else
%>

<tr>
<td align="center" colspan="7">恭喜,没有统计信息,请保持!</td>
</tr>

<%
end if
%>

</table>




<table width="650" border="1" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#DFDFDF">
<td align="center" height="30">
<%if rs88.pagecount > 0 then%> 共<%=rs88.recordcount%>条记录 每<%=rs88.PageSize%>个/页
当前页: <%=intpage%>/<%=rs88.PageCount%> <%else%> 当前页: 0/0 <%end if%>
<a href="search.asp?page=1">首页</a> |
<%if pre then%>
<a href="search.asp?page=<%=intpage -1%>"> 上一页</a> | <%end if%>
<%if last then%>
<a href="search.asp?page=<%=intpage +1%>"> 下一页</a> | <%end if%>
<a href="search.asp?page=<%=rs88.PageCount%>">尾页</a> | 转到第
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs88.PageCount
if i = intpage then%>
<option value="search.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="search.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select> 页 </font>
</td>
</tr>
</table>



</form>


<%
rs88.close
set rs88=nothing

conn.close
set conn=nothing
%>
搜索更多相关主题的帖子: 时间段 include style content title 
2017-06-01 09:02
lsmmh
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2017-5-31
得分:0 
谢谢大家,解决问题了!
2017-06-02 22:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-477517-1-1.html




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

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