注册 登录
编程论坛 新人交流区

请教!分页求和问题?

greatyollow 发布于 2007-10-04 08:30, 769 次点击
用循环求和,分页后,只统计了最后一页的和值?
用select语句,则没有数值.整了好几天了.请哪位朋友指点一二!

附,语句如下:
………………
set rs=server.CreateObject("ADODB.RecordSet")
if Request("user_zhuozhe_name")="" and Request("user_dangwei_file")="" and Request("user_fashong_fangshi")="" then
rs.Source="select * from client where kfsj between #"&uptime&"# and #"&uptime1&"# order by id desc"
else
if Request("user_fashong_fangshi")="" then
if Request("user_dangwei_file")="" then
rs.Source="select * from client where zhuozhe_name like '%"&Request("user_zhuozhe_name")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
else
rs.Source="select * from client where client_adr like '%"&Request("user_dangwei_file")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
else
rs.Source="select * from client where fashong_fangshi="&request("user_fashong_fangshi")&" and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
end if
rs.Open rs.Source,conn,1,1
sql="select sum(freight) as from client" '//client是表名
if not rs.EOF then
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = Page
total = rs.RecordCount
………………
<td width="8%" height="18" align="right" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=num%></td>
12 回复
#2
greatyollow2007-10-04 08:45

哪位朋友帮忙看一下嘛!!!!!!!

#3
greatyollow2007-10-04 08:48
刚才粘贴的时候有误:

sql="select sum(freight) as num from client"

仍然没法出结果。
#4
greatyollow2007-10-04 10:05
#5
nuciewth2007-10-04 10:09
不懂,帮顶一下.
#6
greatyollow2007-10-04 10:34

用select语句,则没有数值.整了好几天了.请哪位朋友指点一二!

附,语句如下:
………………
set rs=server.CreateObject("ADODB.RecordSet")
if Request("user_zhuozhe_name")="" and Request("user_dangwei_file")="" and Request("user_fashong_fangshi")="" then
rs.Source="select * from client where kfsj between #"&uptime&"# and #"&uptime1&"# order by id desc"
else
if Request("user_fashong_fangshi")="" then
if Request("user_dangwei_file")="" then
rs.Source="select * from client where zhuozhe_name like '%"&Request("user_zhuozhe_name")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
else
rs.Source="select * from client where client_adr like '%"&Request("user_dangwei_file")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
else
rs.Source="select * from client where fashong_fangshi="&request("user_fashong_fangshi")&" and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
end if
rs.Open rs.Source,conn,1,1
sql="select sum(freight) as from client" '//client是表名
if not rs.EOF then
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = Page
total = rs.RecordCount
……………… ’//这是分页显示、列表等,以下是最后一行加上总和的值
<td width="8%" height="18" align="right" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=num%></td>

哪能位朋友抽点时间,帮忙看一下。

#7
笨得够呛2007-10-04 10:37
看不懂,也顶
#8
greatyollow2007-10-04 10:50
版主,帮忙看一下!!可不要让一个新手失望哟!!
#9
greatyollow2007-10-05 11:41
#10
coachard2007-10-05 11:46
那么多SQL看了有点晕,不过有个问题,下面的SQL你在哪里执行了???
sql="select sum(freight) as from client"

怎么看不见执行语句???
#11
nazijack2007-10-05 11:54
看看
#12
greatyollow2007-10-05 12:22
sql="select sum(freight) as num from client"
粘掉了
#13
greatyollow2007-10-05 12:24
coachard你好!能说详细点吗
1