| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 507 人关注过本帖, 1 人收藏
标题:ASP 网站如何加入按价格查询整个网站产品,分别加入“从低到高”和“从高到 ...
只看楼主 加入收藏
xny198482
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-6-9
结帖率:0
收藏(1)
已结贴  问题点数:10 回复次数:2 
ASP 网站如何加入按价格查询整个网站产品,分别加入“从低到高”和“从高到低”?找热心人帮忙!
ASP网站如何加入按价格查询整个网站产品,分别加入“从低到高”和“从高到低”?找热心人帮忙!

我完全是新手,新得连现成的源码大部分都读不懂,恳请老师们帮帮忙?谢谢!

源码如下,如何在里面添加 “从低到高”和“从高到低”这两个产品价格查询功能??

<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<html>
<head>
<title><%=webname%>--报价中心</title>

<LINK href="images/css1.css" type=text/css rel=stylesheet>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="head.asp"-->
<table width="980" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10" class="menuer_linebg"></td>
  </tr>
</table>
<table width="980" height="200" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="15"></td>
    <td width="206" valign="top"><!--#include file="userinfo.asp"-->
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="15"></td>
          </tr>
        </table>
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="15"></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/box_smtop.gif" width="200" height="28"></td>
          </tr>
          <tr>
            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="8"></td>
                </tr>
              </table>
                <TABLE style="PADDING-TOP: 10px" cellSpacing=0 cellPadding=0 width="102%"
align=center border=0>
                  <TBODY>
                    <TR>
                      <TD align="center" class="box3"><!--#include file="include/sort.asp"-->
                      </TD>
                    </TR>
                  </TBODY>
              </TABLE></td>
          </tr>
    </table></td>
    <td width="15"></td>
    <td width="744" valign="top"><table width="100%" align="center" border="0" cellspacing="0" cellpadding="0"  bordercolor="#CCCCCC">
      <tr>
        <td height="28" valign="middle"  background="images/bgpr.gif" bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <a href="price.asp">报价中心</a> </td>
      </tr>
      <tr>
        <td width="700" valign="top"><table cellspacing=0 cellpadding=0 width=100% align=center border=0>
      <tbody>
        <tr>
          <td class=b valign=top align=left width=100% >
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0"  bordercolor="#CCCCCC">
                <tr>
                  <td width="100%" align="center" valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td align="left" height="28" background="skin/skin<%=skinid%>/pdbg01.gif">&nbsp;</td>
                      </tr>
                      <tr bgcolor="#ffffff">
                        <td  valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                           
                            <%
                            anid=trim(request("anid"))
                            %>
                              <td><table width="100%" border="0" cellpadding="0" cellspacing="0" dwcopytype="CopyTableCell">
          <tr>
                <td align=center><span class="style2">
                 <a href="price.asp">全部商品</a> <% set rs=server.CreateObject("adodb.recordset")
rs.open "select * from bsort order by anclassidorder asc",conn,1,1
do while not rs.eof
          response.write "<img src='images/ring01.gif'>  <A href=?anid="&rs("anclassid")&">"&trim(rs("anclass"))&"</a>  "
         rs.movenext
loop
rs.close
set rs=Nothing
         %>
                  </span></td>
          </tr>
        </table><%
Const MaxPerPage=20
dim totalPut   
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
if anid<>"" then
rs.open "select * from products where  anclassid="&anid&" order by adddate desc",conn,1,1
else
select case selectm
case ""
rs.open "select * from products order by adddate desc",conn,1,1
case "0"
rs.open "select * from products order by adddate desc",conn,1,1
case "shopid"


end select
end if

if rs.eof And rs.bof then
Response.Write "<p align='center'>此分类下暂无商品!</p>"
%>
                          </td>
                            </tr>
                          </table></td>
                      </tr>
                  </table></td>
                </tr>
              </table>
            </td>
          <td ></td>
        </tr>
      </tbody>
    </table>
    <%
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,"Price.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move  (currentPage-1)*MaxPerPage
dim shopmark
shopmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"Price.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"Price.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
          </td>
        </tr>
    </table></td>
  </tr>
                  </table></td>
                </tr>
              </table>
            </td>
          <td ></td>
        </tr>
      </tbody>
    </table>
      <form name="form1" method="post" action="">
        <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999">
          <tr bgcolor="#C7D3E6">
            <td height="28" align="center" bgcolor="#F7F7F7">商品序号</td>
            <td height="28" align="center" bgcolor="#F7F7F7">商品名称</td>
            <td height="28" align="center" bgcolor="#F7F7F7">市场价</td>
            <td height="28" align="center" bgcolor="#F7F7F7">会员价</td>
             <td height="28" align="center" bgcolor="#F7F7F7">VIP价</td>
            <td height="28" align="center" bgcolor="#F7F7F7">当前库存</td>
            <td height="28" align="center" bgcolor="#F7F7F7">商品品牌</td>
            <td height="28" align="center" bgcolor="#F7F7F7">规格</td>
          </tr>
          <%do while not rs.eof%>
          <tr bgcolor="#F0F3F8">
            <td height="23" align="center" bgcolor="#FFFFFF"><%=rs("bookid")%></td>
            <td height="18" align="left" bgcolor="#FFFFFF" style='PADDING-LEFT: 10px'><img src="images/price_ico.png" width="11" height="11" />
              <a href=products.asp?id=<%=rs("bookid")%> target="_blank">
              <%
    if len(trim(rs("bookname")))>28 Then
    response.write left(trim(rs("bookname")),28)&".."
    Else
    response.write trim(rs("bookname"))
    End If
    %>
              </a></td>
            <td height="18" align="center" bgcolor="#FFFFFF"><s><%=rs("shichangjia")%>元</s></td>
            <td height="18" align="center" bgcolor="#FFFFFF"><%=rs("huiyuanjia")%>元</td>
             <td height="18" align="center" bgcolor="#FFFFFF"> <%if Request.Cookies("cnhww")("reglx")=2 then%>
              <%=rs("vipjia")%>元
              <%else%>
              <font color="#FF3333">VIP可见</font>
              <%end if%></td>
            <td height="18" align="center" bgcolor="#FFFFFF"><%=rs("kucun")%></td>
            <td height="18" align="center" bgcolor="#FFFFFF"><%=rs("pingpai")%></td>
            <td height="18" align="center" bgcolor="#FFFFFF"><%=rs("isbn")%></td>
          </tr>
          <%
  i=i+1
  if i>=MaxPerPage then Exit Do
  rs.movenext
  Loop
  rs.close
  set rs=Nothing
  %>
        </table>
      </form>
      
      
      <%
End Sub
Function showpage(totalnumber,maxperpage,filename)  
Dim n

If totalnumber Mod maxperpage=0 Then  
n= totalnumber \ maxperpage  
Else
n= totalnumber \ maxperpage+1  
End If

Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&" >"  
Response.Write "<p align='center'> "  
If CurrentPage<2 Then  
Response.Write "首页 上一页 "  
Else  
Response.Write "<a href="&filename&"?page=1&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">首页</a> "  
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">上一页</a> "  
End If

If n-currentpage<1 Then  
Response.Write "下一页 尾页"  
Else  
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">"  
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">尾页</a>"  
End If  
Response.Write " 页次:"&CurrentPage&"/"&n&"页 "  
Response.Write " 共有"&totalnumber&"种商品 "
Response.Write "转到:<input type='text' name='page' size=2 maxlength=10 value="&currentpage&">"  
Response.Write "&nbsp;<input type='submit' value='GO' name='cndok'></form>"  
End Function  
%> </td>
      </tr>
    </table></td>
    <td width="24">&nbsp;</td>
  </tr>
</table>
<!--#Include file="end.asp"-->
</body>
</html>

[ 本帖最后由 xny198482 于 2014-6-10 21:27 编辑 ]
搜索更多相关主题的帖子: ASP网站 include title 产品 如何 
2014-06-10 20:58
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
收藏
得分:10 
必须有相应的字段的。

order by riqi desc,id desc


这个意思就是按照日期降序,然后 id 降序。

ASP讨论QQ群:251346273
2014-06-11 19:23
ke爱的小tu子
Rank: 2
等 级:论坛游民
帖 子:51
专家分:20
注 册:2021-2-11
收藏
得分:0 
order by id desc
2021-02-16 21:26
快速回复:ASP 网站如何加入按价格查询整个网站产品,分别加入“从低到高”和“从 ...
数据加载中...
 
   



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

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