标题:[高手请教]asp代码查询access只能显示一张图片
只看楼主
tl1014
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-31
 问题点数:0 回复次数:8 
[高手请教]asp代码查询access只能显示一张图片
麻烦高手帮我看一下。我是刚学ASP的。在网上下载了一个交友程序,我改他一段代码。我想让他显示十张图片,select top 10 可是不知道为什么,只显示一张。麻烦大家帮我看一下。。谢啦 。
<marquee scrollamount=1 scrolldelay=73 valign=middle behavior="scroll">
<table height="200" border="0" cellpadding="5" cellspacing="1">
<tr>
<td align="center" valign="top" background="images/bg2.gif">
<%
Set rs_girl = Server.CreateObject("ADODB.Recordset")
sql="select top 10 user_id,netname,age,home from larchives where photo > 0 "
rs_girl.open sql,conn,1,1
if rs_girl.eof and rs_girl.bof then%>
<p>没有,暂时空缺!
<%else
Set rs_pic = Server.CreateObject("ADODB.Recordset")
sql="select id from pic where user_id=" & rs_girl("user_id") & " and index = true"
rs_pic.open sql,connpic,1,1
if rs_pic.eof and rs_pic.bof then
pics=1
else
pics=rs_pic("id")
end if
%>
<table border="0" cellspacing="0" cellpadding="3" style="border-collapse: collapse">
<tr>
<td width="90" valign="top"><div align="center"><a href="read.asp?user_id=<%=rs_girl("user_id")%>"><img border="0" src="display.asp?id=<%=pics%>" width="75" height="100" alt="查看详细资料"></a></div></td>
</tr>
<tr>
<td width="90"><font color="#000000"><%=rs_girl("netname")%><img src="images/v2_line.gif" width="90" height="1"><br>
年龄:<%=rs_girl("age")%><img src="images/v2_line.gif" width="90" height="1"><br>
城市:<%=rs_girl("home")%></font></td>
</tr>
</table>
<%rs_girl.close:set rs_girl=nothing%>
<%end if%></td>
</tr>
</table>
</marquee>

[此贴子已经被作者于2007-5-31 15:56:29编辑过]

搜索更多相关主题的帖子: access asp 代码 
2007-05-31 15:32
enlangs
Rank: 1
等 级:等待验证会员
威 望:2
帖 子:218
专家分:0
注 册:2007-5-28
得分:0 
<marquee scrollamount=1 scrolldelay=73 valign=middle behavior="scroll">
<table height="200" border="0" cellpadding="5" cellspacing="1">
<tr>
<td align="center" valign="top" background="images/bg2.gif">
<table border="0" cellspacing="0" cellpadding="3" style="border-collapse: collapse">
<%
Set rs_girl = Server.CreateObject("ADODB.Recordset")
sql="select top 10 user_id,netname,age,home from larchives where photo > 0 "
rs_girl.open sql,conn,1,1
if rs_girl.eof and rs_girl.bof then%>
<p>没有,暂时空缺!
<%else
Set rs_pic = Server.CreateObject("ADODB.Recordset")
sql="select id from pic where user_id=" & rs_girl("user_id") & " and index = true"
rs_pic.open sql,connpic,1,1
if rs_pic.eof and rs_pic.bof then
pics=1
else
pics=rs_pic("id")
do while not rs_pic.eof
%><tr>
<td width="90" valign="top"><div align="center"><a href="read.asp?user_id=<%=rs_girl("user_id")%>"><img border="0" src="display.asp?id=<%=pics%>" width="75" height="100" alt="查看详细资料"></a></div></td>
</tr>
<tr>
<td width="90"><font color="#000000"><%=rs_girl("netname")%><img src="images/v2_line.gif" width="90" height="1"><br>
年龄:<%=rs_girl("age")%><img src="images/v2_line.gif" width="90" height="1"><br>
城市:<%=rs_girl("home")%></font></td>
</tr>
<% rs_pic.movenext
loop


end if
%>
</table>
<%rs_girl.close:set rs_girl=nothing%>
<%end if%></td>
</tr>
</table>
</marquee>


你自己测试下,有问题贴出。。

[此贴子已经被作者于2007-5-31 17:13:31编辑过]

2007-05-31 16:40
tl1014
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-31
得分:0 

非常感谢,呵呵,我按你的说了去试了下。不过还是有问题。。还要麻烦你帮我看一下。。我把整个文件发上吧。。


Microsoft VBScript 编译器错误 错误 '800a0400'

缺少语句

/jy/index.asp,行 828

<tr>
^

bwRwgvpo.txt (78.72 KB) [高手请教]asp代码查询access只能显示一张图片


2007-05-31 16:53
enlangs
Rank: 1
等 级:等待验证会员
威 望:2
帖 子:218
专家分:0
注 册:2007-5-28
得分:0 

刚才忘%>了。我自己电脑出问题了,这朋友电脑没测试环境,

别人做好的网页排版也同样计算好的,你突然增加显示内容也的从新排版。。

从新修改下。

<marquee scrollamount=1 scrolldelay=73 valign=middle behavior="scroll">
<table height="200" border="0" cellpadding="5" cellspacing="1">
<tr>
<td align="center" valign="top" background="images/bg2.gif">
<%
Set rs_girl = Server.CreateObject("ADODB.Recordset")
sql="select top 10 user_id,netname,age,home from larchives where photo > 0 "
rs_girl.open sql,conn,1,1
if rs_girl.eof and rs_girl.bof then%>
<p>没有,暂时空缺!
<%else
Set rs_pic = Server.CreateObject("ADODB.Recordset")
sql="select top 10 id from pic where user_id=" & rs_girl("user_id") & " and index = true"
rs_pic.open sql,connpic,1,1
if rs_pic.eof and rs_pic.bof then
pics=1
else
pics=rs_pic("id")
do while not rs_pic.eof

%>


<table border="0" cellspacing="0" cellpadding="3" style="border-collapse: collapse">
<tr>
<td width="90" valign="top"><div align="center"><a href="read.asp?user_id=<%=rs_girl("user_id")%>"><img border="0" src="display.asp?id=<%=pics%>" width="75" height="100" alt="查看详细资料"></a></div></td>
</tr>
<tr>
<td width="90"><font color="#000000"><%=rs_girl("netname")%><img src="images/v2_line.gif" width="90" height="1"><br>
年龄:<%=rs_girl("age")%><img src="images/v2_line.gif" width="90" height="1"><br>
城市:<%=rs_girl("home")%></font></td>
</tr>
</table>

<%


rs_pic.movenext
loop

end if
%>

<%rs_girl.close:set rs_girl=nothing%>
<%end if%></td>
</tr>
</table>
</marquee>

[此贴子已经被作者于2007-5-31 18:53:24编辑过]

2007-05-31 17:10
tl1014
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-31
得分:0 
呵呵。。你在线啊?还是不行啊。现在代码没错了。可是只有一张图呢。。。。你都帮我看了几次代码了。。不知道怎么谢你啊。
2007-05-31 17:26
tl1014
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-31
得分:0 
要不告诉你的QQ,我加你QQ直接问你OK不?我的8095511。。
2007-05-31 17:27
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
得分:0 
<marquee scrollamount=1 scrolldelay=73 valign=middle behavior="scroll">
<table height="200" border="0" cellpadding="5" cellspacing="1">
<tr>
<td align="center" valign="top" background="images/bg2.gif">
<%
Set rs_girl = Server.CreateObject("ADODB.Recordset")
sql="select top 10 user_id,netname,age,home from larchives where photo > 0 "
rs_girl.open sql,conn,1,1
if rs_girl.eof and rs_girl.bof then%>
<p>没有,暂时空缺!
<%else
Set rs_pic = Server.CreateObject("ADODB.Recordset")
do while not rs_girl.eof

sql="select id from pic where user_id=" & rs_girl("user_id") & " and index = true"
rs_pic.open sql,connpic,1,1
if rs_pic.eof and rs_pic.bof then
pics=1
else
pics=rs_pic("id")
end if
%>
<table border="0" cellspacing="0" cellpadding="3" style="border-collapse: collapse">
<tr>
<td width="90" valign="top"><div align="center"><a href="read.asp?user_id=<%=rs_girl("user_id")%>"><img border="0" src="display.asp?id=<%=pics%>" width="75" height="100" alt="查看详细资料"></a></div></td>
</tr>
<tr>
<td width="90"><font color="#000000"><%=rs_girl("netname")%><img src="images/v2_line.gif" width="90" height="1"><br>
年龄:<%=rs_girl("age")%><img src="images/v2_line.gif" width="90" height="1"><br>
城市:<%=rs_girl("home")%></font></td>
</tr>
</table>
<%rs_girl.movenext
loop%>
<%rs_girl.close:set rs_girl=nothing%>
<%end if%></td>
</tr>
</table>
</marquee>

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-05-31 20:23
enlangs
Rank: 1
等 级:等待验证会员
威 望:2
帖 子:218
专家分:0
注 册:2007-5-28
得分:0 

<marquee scrollamount=1 scrolldelay=73 valign=middle behavior=\"scroll\">
<table height=\"200\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\">
<tr>
<td align=\"center\" valign=\"top\" background=\"images/bg2.gif\">
<%
Set rs_girl = Server.CreateObject(\"ADODB.Recordset\")
sql=\"select top 10 user_id,netname,age,home from larchives where photo > 0 \"
rs_girl.open sql,conn,1,1
if rs_girl.eof and rs_girl.bof then%>
<p>没有,暂时空缺!
<%else
Set rs_pic = Server.CreateObject(\"ADODB.Recordset\")
do while not rs_girl.eof //此时不能进行操作

sql=\"select id from pic where user_id=\" & rs_girl(\"user_id\") & \" and index = true\"
rs_pic.open sql,connpic,1,1
if rs_pic.eof and rs_pic.bof then
pics=1
else
pics=rs_pic(\"id\")
end if
%>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" style=\"border-collapse: collapse\">
<tr>
<td width=\"90\" valign=\"top\"><div align=\"center\"><a href=\"read.asp?user_id=<%=rs_girl(\"user_id\")%>\"><img border=\"0\" src=\"display.asp?id=<%=pics%>\" width=\"75\" height=\"100\" alt=\"查看详细资料\"></a></div></td>
</tr>
<tr>
<td width=\"90\"><font color=\"#000000\"><%=rs_girl(\"netname\")%><img src=\"images/v2_line.gif\" width=\"90\" height=\"1\"><br>
年龄:<%=rs_girl(\"age\")%><img src=\"images/v2_line.gif\" width=\"90\" height=\"1\"><br>
城市:<%=rs_girl(\"home\")%></font></td>
</tr>
</table>
<%rs_girl.movenext
loop%>
<%rs_girl.close:set rs_girl=nothing%>
<%end if%></td>
</tr>
</table>
</marquee>


我重新修改了下,加上排版也改了下.
<marquee scrollamount=1 scrolldelay=73 valign=middle behavior=\"scroll\">
<table height=\"200\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\">
<tr>

<%
Set rs_girl = Server.CreateObject(\"ADODB.Recordset\")
sql=\"select top 10 user_id,netname,age,home from larchives where photo > 0 \"
rs_girl.open sql,conn,1,1
if rs_girl.eof and rs_girl.bof then%>
<td> <p>没有,暂时空缺!</p></td>
<%else
do while not rs_girl.eof
Set rs_pic = Server.CreateObject(\"ADODB.Recordset\")


sql=\"select id from pic where user_id=\" & rs_girl(\"user_id\") & \" and index = true\"
rs_pic.open sql,connpic,1,1
if rs_pic.eof and rs_pic.bof then
pics=1
else
pics=rs_pic(\"id\")
end if
%>
<td>
<table height=\"200\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\">
<tr>
<td align=\"center\" valign=\"top\" background=\"images/bg2.gif\">

<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" style=\"border-collapse: collapse\">
<tr>
<td width=\"90\" valign=\"top\"><div align=\"center\"><a href=\"read.asp?user_id=<%=rs_girl(\"user_id\")%>\"><img border=\"0\" src=\"display.asp?id=<%=pics%>\" width=\"75\" height=\"100\" alt=\"查看详细资料\"></a></div></td>
</tr>
<tr>
<td width=\"90\"><font color=\"#000000\"><%=rs_girl(\"netname\")%><img src=\"images/v2_line.gif\" width=\"90\" height=\"1\"><br>
年龄:<%=rs_girl(\"age\")%><img src=\"images/v2_line.gif\" width=\"90\" height=\"1\"><br>
城市:<%=rs_girl(\"home\")%></font></td>
</tr>
</table>
</td>
</tr>
</table></td>
<%rs_girl.movenext
loop%>
<%rs_girl.close:set rs_girl=nothing%>
<%end if%>
</tr></table>
</marquee>

2007-06-01 08:15
tl1014
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-31
得分:0 

非常感谢每一位游览的人,特别感谢 zhulei1978enlangs ,现在问题已经解决了。正确代码是楼上的。。再次对zhulei1978enlangs 表示感谢。。

2007-06-01 09:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-143844-1-1.html




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

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