| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 439 人关注过本帖
标题:[求助]难题啊
只看楼主 加入收藏
PZGCS
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-24
收藏
 问题点数:0 回复次数:9 
[求助]难题啊

我需要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>

搜索更多相关主题的帖子: 难题 
2007-06-24 01:17
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
order by id desc
2007-06-24 10:14
PZGCS
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-24
收藏
得分:0 
我上述表中的所有列都在1个字段内,因此不知道该怎么加“order by 用来降序的字段 desc”,请高手指点,应该改什么地方啊。
2007-06-24 10:49
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
sql="select * from aa where id="&request("id")
加在sql语句中,希望楼主先看看相关的知识,打个好基础。
2007-06-24 11:38
恒天
Rank: 1
等 级:新手上路
威 望:2
帖 子:165
专家分:0
注 册:2007-6-1
收藏
得分:0 
if request("type2")<>"" then
sql="select * from bb where info like '%"&request("type2")&"%' and aa_id="&request("id") order by id desc
else
sql="select * from bb where aa_id="&request("id") order by id desc
end if

这里默认id为自动增加的主键
2007-06-24 12:13
PZGCS
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-24
收藏
得分:0 
按恒天老师的方案还是不行啊,显示语句未结束。
那位老师再帮帮我啊。
2007-06-24 14:10
恒天
Rank: 1
等 级:新手上路
威 望:2
帖 子:165
专家分:0
注 册:2007-6-1
收藏
得分:0 
主要是我还没明白你那程序的意思
2007-06-24 14:28
PZGCS
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-24
收藏
得分:0 
恒天老师,我的表单显示共8列,但8列的数据都在 bb 表的info字段内,按您是意思取 ID值进行排序我也明白,但就是不知道怎么做啦。
2007-06-24 14:37
PZGCS
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-24
收藏
得分:0 
请求帮助啊。请大家施以援手。
2007-06-24 15:32
PZGCS
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-24
收藏
得分:0 
谢谢各位老师了,已解决。

改成&" order by id desc"就OK了。
2007-06-24 17:45
快速回复:[求助]难题啊
数据加载中...
 
   



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

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