回 帖 发 新 帖 刷新版面

主题:[求助]难题啊

我需要asp表单输出为倒序排列,也就是说最新的输入在最前面,请高手帮忙。以下为源码。
源码:
<title>报表</title>
<!--#include file="conn.asp"-->
<style type="text/css">
<!--
.STYLE2 {font-size: small}
body {
    background-image: url(tp/bj4.gif);
    margin-top: 0px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td width="84%"><form id="form1" name="form1" method="post" action="search_4.asp?id=<%=request("id")%>">
  <p>关键词
        <input name="type2" type="text" id="type2" value="<%=request("type2")%>" />
        <input type="submit" name="Submit" value="查询" />
        <br />
</p>
  </form>
  
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr><%
sql="select * from aa where id="&request("id")
rs.open sql,conn,1,2
info=split(rs("info"),"‖")
bei=split(rs("bei"),"‖")
show=split(rs("show"),"‖")
rs.close
i=0
while i<ubound(info)
if show(i)="是" then
%>
  
    <td width="<%=int(100/ubound(info))%>%" height="30" align="center" bgcolor="#CCCCCC"><strong><%=info(i)%></strong></td>

    <%
    end if
  i=i+1
  wend
  %>  
</tr>
  <%

'搜索


if request("type2")<>"" then
  sql="select * from bb where info like '%"&request("type2")&"%' and aa_id="&request("id")
else
  sql="select * from bb where aa_id="&request("id") 
end if
      
  
  rs.open sql,conn,1,2
    '设置页数
    if not rs.eof then
if request("page")<>"" then
page=request("page")
else
page=1
end if
rs.pagesize=20
if page<>"" then
rs.absolutepage=page
end if
end if
p=0
  while not rs.eof and p<20
  info=split(rs("info"),"‖")
  %>

  <tr>
  <%
  i=0
  while i<ubound(info)
  if show(i)="是" then
  %>
  
    <td align="center" bgcolor="#FFFFFF">
      <span class="STYLE2">
      <%if bei(i)="图片" then%>
      <img src="<%=info(i)%>" width="50" height="50" /></span>
      <span class="STYLE2">
      <%else%>
      <%if i=0 then%>
      <a href="view.asp?aa_id=<%=request("id")%>&amp;id=<%=rs("id")%>" target="_blank"><%=info(i)%></a>
      <%else%>
      <%=info(i)%>
      <%end if
    end if%>    
      </span></td>

     <%
     end if
    
  i=i+1
  wend
  %>
        </tr>
  
  <% p=p+1
  rs.movenext
  wend
  %>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#66CCFF">
  <tr>
    <td height="28" bgcolor="88A2BD"><div align="center"><font color="#FFFFFF" size="2"><a href="6.asp">IQC管理</a>共有<%=rs.recordcount%>条搜索记录,每页显示20条,分<%=page%>/<%=rs.pagecount%>页 
        ,<%if request("page")="" then%>
        首页 下一页
        <%else%>
        <a href="search_4.asp?type2=<%=type2%>&amp;id=<%=request("id")%>&amp;page=1">首页</a> <a href="search_4.asp?type2=<%=type2%>&amp;id=<%=request("id")%>&amp;page=<%=page-1%>"> 上一页 </a>
        <%end if%>
        <%if int(page)=int(rs.pagecount) then%>
        下一页 尾页
        <%else%>
        <a href="search_4.asp?type2=<%=type2%>&amp;id=<%=request("id")%>&amp;page=<%=page+1%>">下一页 </a> <a href="search_4.asp?type2=<%=type2%>&amp;id=<%=request("id")%>&amp;page=<%=rs.pagecount%>">尾页</a>
        <%end if%>
    </font> </div></td>
  </tr>
</table></td>
  </tr>
</table>

</body>
</html>

回复列表 (共3个回复)

沙发

sql语句按时间或id倒序排序就可以了,即
sql="…… order by time desc"
sql="…… order by id desc"

板凳

根据where后的条件倒叙排列

3 楼

该下SQL语句就行了~

我来回复

您尚未登录,请登录后再回复。点此登录或注册