asp数据库数据显示问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 15:10:43
我在页面中插入一个表格 里面显示数据库中的数据 测试时数据能显示 但是页面全都乱了 左一个右一个的 代码如下
<%
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from rj"
rs.open sql,conn,1,1
rs.PageSize=5
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%>

<td width="7%"><%=rs("id")%></td>
<td width="67%"><%=rs("title")%></td>
<td width="26%"><%=rs("time")%></td>

<%
i=i+1
rs.movenext
if rs.eof then exit for
next
%>

<%
rs.close
set rs=nothing
%>

代码似乎没错 也能连接数据库 就是页面非常乱 改了好几次还是那样 请高手说下如何改 为什么要这样改
我上面只是其中一部分代码 该有的都有 就只显示的时候数据不在表格里

少了<tr></tr>,应该为:
<%
......
for j=1 to rs.PageSize
%>

<tr>
<td width="7%"><%=rs("id")%></td>
<td width="67%"><%=rs("title")%></td>
<td width="26%"><%=rs("time")%></td>
</tr>

<%
i=i+1
......
%>

那把完整代码帖出来啊,否则怎么知道你哪里出错了啊?