在线等,相当于排序的问题●●●●●●●

wupeipei 2005-05-04 07:23:41
用文字不好途述,ACCESS表如下:

name sex message
------------------------------------------
xumw 1 test
peipei 2 test
zhe 1 test
shi 2 test
……

客户端页面显示
xumw peipei
zhe shi
意思是sex为1的会在表格的左边显示,为2的显示在表格的右边

如果写成exec="select * form guestbook where sex=1"这样只能会实现一列的功能。
是否可以在显示的时候判断如:
<%if not rs.eof ?????%>  ?号写成and sex=1
……
这样不行,如何解决。TKS!

不知朋友们是否明白我的意思。
...全文
108 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wupeipei 2005-05-04
  • 打赏
  • 举报
回复
多谢几位帮忙,给分……
xumw 2005-05-04
  • 打赏
  • 举报
回复
楼上的方法正确,但更正一下,两个记录集的名称不能一样,否则会出现冲突。
xiaoyao888 2005-05-04
  • 打赏
  • 举报
回复
最简单的方法是把RS分成两个记录集
rs.filter="sex=1"
set rs1=rs
rs.filter="sex=2"
set rs2=rs

或者直接用两个记录集

用一个循环也可以,要保证你的SEX是1,2交错的,这个得在建立得时候就排好
<table>
<%
while not rs.eof
%>
<tr>
<td>
<%
response.write(rs("name"))
rs.movenext
%>
</td>
<td>
if not rs.eof then
response.write(rs("name"))
rs.movenext
end if
%>
<td>
</tr>
<%wend%>
</table>


流浪河 2005-05-04
  • 打赏
  • 举报
回复
或者也可以利用表格的嵌套即 
<table>
<tr>
<td><table><tr></tr>.....</table></td>
<td><table><tr></tr>.....</table></td>
</tr>
</table>
左边的显示sex=1的 右边的为sex=2的
但是记住在第一次查询结束 即sex=1的查询结束后,请先
<%rs.close
set rs=nothing%>
然后再

<%
SET rs=CONN.execute("select * form guestbook where sex=2")
if not rs.eof then
%>

这样基本上可以实现效果了

更正了以下,不好意思,刚才写快了
流浪河 2005-05-04
  • 打赏
  • 举报
回复
或者也可以利用表格的嵌套即 
<table>
<tr>
<td><table><tr></tr>.....</table></td>
<td><table><tr></tr>.....</table></td>
</tr>
</table>
左边的显示sex=1的 右边的为sex=2的
但是记住在第一次查询结束 即sex=1的查询结束后,请先
<%rs.close
set rs=nothing%>
然后再

<%
SET rs=CONN.execute("select * form guestbook where sex=1")
if not rs.eof then
%>

这样基本上可以实现效果了1
hjmsolar 2005-05-04
  • 打赏
  • 举报
回复
把user按sex分配在两个数组中,在循环显示,就ok 了!!!

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧