标题: 求助!!!还是求和的问题 [打印本页] 作者: ■■■■■■ 时间: 2010-1-13 07:12 标题: 求助!!!还是求和的问题 多些版主大哥的帮助
<%
set rs=server.CreateObject("adodb.recordset")
sql= "SELECT SUM(fdate) AS fdate,SUM(hits) AS hits from soft where fdate=2005"
rs.open sql,conn,1,1
%>
…………………………………………………………………………… {<%=rs("fdate")%> }{<%=rs("hits")%>} </td>
如何求当前页中的和,而不是整个字段中的呢??作者: 红苹果校园 时间: 2010-1-13 07:12
做循环作者: FIFA2007 时间: 2010-1-13 07:12
能否说的详细一点,谢谢。作者: 逍遥的雨夜 时间: 2010-1-13 07:12
如何求当前页中的和,而不是整个字段中的呢??
现在的源代码发上来 我看看作者: lianeh 时间: 2010-1-13 07:13
以下是源码,谢谢
<!--#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="default1.asp">
<div align="center">
<table width="950" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr bgcolor="#E8F1FF">
<td height="25" background="bg1.gif"> </td>
</tr>
<tr bgcolor="#E8F1FF">
<td height="25" background="bg1.gif"> <a href="admin"><font color="#ffffff">管理员入口</font></a></td>
</tr>
<tr bgcolor="#E8F1FF">
<td height="25" background="bg1.gif">
<div align="center">
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
<tr>
<td width="120" align="center" rowspan="2"> <select size="1" name="ztname" style="width:120">
<option selected value="0">订货单位</option>
<%
set ztrs=conn.execute("select * from zhuanti order by ztorder")
do while not ztrs.eof
%>
<option value=<%=ztrs("ztname")%>><%=ztrs("ztname")%></option>
<%
ztrs.movenext
loop
set ztrs=nothing
%>
</select></td>
</tr>
<tr>
<td width="120" height="15" align="center"> <p align="left">
<select size="1" name="guigename" style="width:120">
<option selected value="0">规格</option>
<%
set guigers=conn.execute("select * from guige order by guigeorder")
do while not guigers.eof
%>
<option value=<%=guigers("guigename")%>><%=guigers("guigename")%></option>
<%
guigers.movenext
loop
set guigers=nothing
%>
</select>
</td>
<td width="120" align="right"><select size="1" name="liduname" style="width:120">
<option selected value="0">粒度</option>
<%
set lidurs=conn.execute("select * from lidu order by liduorder")
do while not lidurs.eof
%>
<option value=<%=lidurs("liduname")%>><%=lidurs("liduname")%></option>
<%
lidurs.movenext
loop
set lidurs=nothing
%>
</select> </td>
<td width="120" align="center"> <p align="left">
<select size="1" name="jhjname" style="width:120">
<option selected value="0">结合剂</option>
<%
set jhjrs=conn.execute("select * from jhj order by jhjorder")
do while not jhjrs.eof
%>
<option value=<%=jhjrs("jhjname")%>><%=jhjrs("jhjname")%></option>
<%
jhjrs.movenext
loop
set jhjrs=nothing
%>
</select>
</td>
<td width="205" align="center"> <select name="year1" size="1">
<%for i=2000 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>
日 </td>
<td width="255" align="center"> <input name="keyword" type="text" id="keyword" size="25">
<input type="submit" name="Submit" value="搜 索"></td>
</tr>
<tr>
<td width="120" height="15" align="center"> <select size="1" name="bigname" style="width:120">
<option selected value="0">形状</option>
<%
set bigrs=conn.execute("select * from big_class order by bigorder")
do while not bigrs.eof
%>
<option value=<%=bigrs("bigname")%>><%=bigrs("bigname")%></option>
<%
bigrs.movenext
loop
set bigrs=nothing
%>
</select></td>
<td width="120" align="center"> <p align="left">
<select size="1" name="smallname" style="width:120">
<option selected value="0">材质</option>
<%
set smallrs=conn.execute("select * from small_class order by smallorder")
do while not smallrs.eof
%>
<option value=<%=smallrs("smallname")%>><%=smallrs("smallname")%></option>
<%
smallrs.movenext
loop
set smallrs=nothing
%>
</select>
</td>
<td width="120" align="right"><select size="1" name="yingduname" style="width:120">
<option selected value="0">硬度</option>
<%
set yingdurs=conn.execute("select * from yingdu order by yingduorder")
do while not yingdurs.eof
%>
<option value=<%=yingdurs("yingduname")%>><%=yingdurs("yingduname")%></option>
<%
yingdurs.movenext
loop
set yingdurs=nothing
%>
</select> </td>
<td width="120" align="center"> <p align="left">
<select size="1" name="xsdname" style="width:120">
<option selected value="0">线速度</option>
<%
set xsdrs=conn.execute("select * from xsd order by xsdorder")
do while not xsdrs.eof
%>
<option value=<%=xsdrs("xsdname")%>><%=xsdrs("xsdname")%></option>
<%
xsdrs.movenext
loop
set xsdrs=nothing
%>
</select>
</td>
<td width="205" align="center"> <select name="year2" size="1">
<%for i=2000 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>
日</td>
<td width="255" align="center"> </td>
</tr>
</table>
</div>
</td>
</tr>
<tr bgcolor="#E8F1FF">
<td height="25" background="bg1.gif"><table width="950" border="1" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr>
<td width="30" align="center" bgcolor="#C0C0C0" background="images/admin_bg_1.gif">
</td>
<td width="100" align="center" background="images/admin_bg_1.gif" bgcolor="#C0C0C0">
<b></b></td>
<td width="180" align="center" bgcolor="#C0C0C0" background="images/admin_bg_1.gif">
<b><font color="#FFFFFF"></font></b></td>
<td width="420" align="center" bgcolor="#C0C0C0" background="images/admin_bg_1.gif"><b></b></td>
<td width="70" align="center" bgcolor="#C0C0C0" background="images/admin_bg_1.gif"><b></b></td>
</tr>
<%'开始分页
Const MaxPerPage=60
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"))
bigname=trim(request("bigname"))
smallname=trim(request("smallname"))
keyword=trim(request("keyword"))
guigename=trim(request("guigename"))
liduname=trim(request("liduname"))
yingduname=trim(request("yingduname"))
jhjname=trim(request("jhjname"))
xsdname=trim(request("xsdname"))
startdate=Request("year1")&Request("month1")&Request("day1")
enddate=Request("year2")&Request("month2")&Request("day2")
stitle=request("stitle")
scontent=request("scontent")
if ztname<>"" then
if ztname<>"0" then
sql=sql&" and ztname like '%"&ztname&"%'"
end if
end if
if bigname<>"" then
if bigname<>"0" then
sql=sql&" and bigname like '%"&bigname&"%'"
end if
end if
if smallname<>"" then
if smallname<>"0" then
sql=sql&" and smallname like '%"&smallname&"%'"
end if
end if
if guigename<>"" then
if guigename<>"0" then
sql=sql&" and guigename like '%"&guigename&"%'"
end if
end if
if liduname<>"" then
if liduname<>"0" then
sql=sql&" and liduname like '%"&liduname&"%'"
end if
end if
if yingduname<>"" then
if yingduname<>"0" then
sql=sql&" and yingduname like '%"&yingduname&"%'"
end if
end if
if jhjname<>"" then
if jhjname<>"0" then
sql=sql&" and jhjname like '%"&jhjname&"%'"
end if
end if
if xsdname<>"" then
if xsdname<>"0" then
sql=sql&" and xsdname like '%"&xsdname&"%'"
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,"default1.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"default1.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"default1.asp"
end if
end if
end if
sub showContent
dim i
i=0%>
<%do while not rs.eof%>
<tr>
<td STYLE='PADDING-LEFT: 10px'><div align="center"></div></td>
<td STYLE='PADDING-LEFT: 10px'><b><a target="_blank" href=show.asp?id=<%=rs("id")%>>
</a></b></td>
<td align="center"> <div align="left"><font color="#0000FF"><b><a target="_blank" href=show.asp?id=<%=rs("id")%>>
</a></b></font></div></td>
<td align="center"><b><a target="_blank" href=show.asp?id=<%=rs("id")%>>
</a></b></td>
<td align="center"><b><font color="#CC3300"><a href="<%=rs("softurl")%>">
</a></font><a target="_blank" href=show.asp?id=<%=rs("id")%>>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</a></b></td>
</tr>
<tr>
<td height="15" colspan="5">
<%
set rs=server.CreateObject("adodb.recordset")
sql= "SELECT SUM(fdate) AS fdate,SUM(hits) AS hits from soft where fdate=2005"
rs.open sql,conn,1,1
%>
… {<%=rs("fdate")%> }{<%=rs("hits")%>}</td>
</tr>
<tr bgcolor="#99CCFF">
<td height="15" colspan="5" align="right">
<font color="#FFFFFF" size="2">
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n