注册 登录
编程论坛 ASP技术论坛

我是新手,这个页面怎么不能显示啊.愁死了

wjhbj210 发布于 2009-09-27 11:09, 405 次点击
<!--#include file="conn.asp"-->
<html>
<head>
<body>
<p><b><a href="say.asp">发表帖子</a></b>
<hr size="1" width="90%" >
<table width="454" border="1" align="center">

  <tr>
    <td width="83%" align="center">标题</td>
    <td width="17%" align="center">作者</td>
  </tr>
  </table>
  
  <table width="454" border="1" align="center">
  <tbody><tr>
  <%
set rs=server.createobject("adodb.recordset")
sql="select * from bbs order by id"
rs.open sql,conn,1,1
if rs.recordcount=0 then
           response.write "暂时还没有发表的帖子!"
           rs.close
           else
           %>
  <%
for i=1 to 20   
%>
    <td width="83%">      
    <a target="_blank" href="show.asp?id=<%=rs("id")%>"><%=rs("title")%></a>   
    </td>
    <td width="17%"><%=rs("user")%></td>
  </tr>
   <%
rs.movenext
if rs.eof then exit for
next
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%
end if
%>
  </tbody>
  </table>
<hr size="1" width="90%">

</body>
</head>
</html>
3 回复
#2
yms1232009-09-27 15:42
有没有显示什么错误页面的信息?
#3
myosotis2009-09-27 16:47
是不是数据库链接有问题,或者sql语句错了
程序本身没有问题
#4
chenguoxing5172009-09-28 16:36
会不会是
for i=1 to 20
这个循环的问题,你都不知道读取的记录有没有20条?
建议直接将sql语句select * from bbs order by id改为select top 20 * from bbs order by id
1