怎样分别显示?

ryuginka 2004-07-05 03:50:01
我的查询语句,要求将结果一行显示两个记录,怎样做?


谢谢.请给个例子.
...全文
126 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
ryuginka 2004-07-08
  • 打赏
  • 举报
回复
UP
ryuginka 2004-07-07
  • 打赏
  • 举报
回复
up
dragonlyf 2004-07-07
  • 打赏
  • 举报
回复
<%
colornum=1
do while not Rs.EOF and colornum<=Rs.PageSize
'colornum=colornum+1
%>
<tr align="center">
<%for i=0 to 4
if not Rs.EOF then
colornum=colornum+1
%>

<td width="20%" height="178">
<table width="85%" border="0" cellpadding="0" cellspacing="1" bgcolor="#e4e4e4">
<tr>
<td height="120" align="center" bgcolor="#E7E7E7">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td><a href="javascript:MM_openBrWindow('employeephoto_show.asp?path=<%=rs("pic")%>&op=y','员工照片','width=500,height=580')">
<%if rs("pic")="" or isnull(rs("pic")) then
pic="images/photo.gif"
else
pic="photo/"&Rs("pic")
end if
%>
<img border="0" src="<%=pic%>" width="80" height="100" /></a></td>
</tr>
</table></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="1">
<tr>
<td align="center" height="50">
姓名:<a href="javascript:MM_openBrWindow('employee_show.asp?id=<%=rs("id")%>','员工详细信息','width=510,height=580,resizable=yes,scrollbars=yes')"><%=Rs("truename")%></a><br />
</td>
</tr>
</table></td>
<%
Rs.MoveNext
else
%>

<td width="20%" height="178">
<table width="85%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D8D8D8">
<tr>
<td height="120" align="center" bgcolor="#E7E7E7">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td><img src="images/photo.gif" width="80" height="100" /></td>
</tr>
</table></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="1">
<tr>
<td align="center" height="50"><br />
<br /> </td>
</tr>
</table></td>
<%
end if
next%>
</tr>
<%
loop
%>
这里每行显示4张,只要for语句中值改动一下就ok了
ryuginka 2004-07-07
  • 打赏
  • 举报
回复
有代码吗?我是一个一行输出2张图片的,应该一样的吧.
fairleng 2004-07-07
  • 打赏
  • 举报
回复
逢2嵌入一个回车符号
ryuginka 2004-07-07
  • 打赏
  • 举报
回复
我看看,再试试.谢谢大家了.
jervis82 2004-07-07
  • 打赏
  • 举报
回复
晕。。。。。。。。。。。。。。。。
kid5 2004-07-07
  • 打赏
  • 举报
回复
你应该把 danjingwu(寒夜孤风) 的回复看明白,一般豆是他的那种写法。
银狐被占用 2004-07-07
  • 打赏
  • 举报
回复
同意 danjingwu(寒夜孤风)
ryuginka 2004-07-07
  • 打赏
  • 举报
回复
up
zhouyouok 2004-07-05
  • 打赏
  • 举报
回复
少了一句
i=0
rs.open "select * from table",conn,1,1
while not rs.eof
if i<2 then
i=i+1
response.write rs("字段")
else
i=0
response.write "<br>"
end if
wend
zhouyouok 2004-07-05
  • 打赏
  • 举报
回复
i=0
rs.open "select * from table",conn,1,1
while not rs.eof
if i<2 then
i=i+1
response.write rs("字段")
else
i=0
end if
wend
ryuginka 2004-07-05
  • 打赏
  • 举报
回复
不明白,还有简单的吗?
danjingwu 2004-07-05
  • 打赏
  • 举报
回复
sql="select name,id from table"
rst.Open sql,conn,1,1
while not rst.eof
Response.write "<tr>"
if not rst.eof then
Response.write "<td>"&name&"</td>"
rst.movenext
else
Response.write "<td> </td>"
end if

if not rst.eof then
Response.write "<td>"&name&"</td>"
rst.movenext
else
Response.write "<td> </td>"
end if
wend


这只是简单的例子,原理就是用行来做循环
然后在每列的时候都判断是否还有记录,有就显示,没有就不显示!
ryuginka 2004-07-05
  • 打赏
  • 举报
回复
up

28,391

社区成员

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

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