asp循环显示数据库内容问题
<body><%dimsql,rssql="select*frommessorderbyiddesc"setrs=server.CreateObject("adodb.r...
<body>
<%
dim sql,rs
sql="select*from mess order by id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
%>
<table width="500" height="200" border="1" align="center">
<%
response.Write "<tr>"
for i=0 to rs.fields.count-1
response.write "<td>"&trim(rs.fields(i).name)&"</td>"
next
response.write "</tr>"
%>
<%
do while not rs.eof
response.Write "<tr>"
for i=0 to rs.fields.count-1
response.Write "<td>"&trim(rs.fields(i).value)&"<td>"
next
rs.movenext
response.Write"</tr>"
loop
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
这是主要代码,能输出数据,但是输出的数据位置不对,对不齐,
谁会帮下忙,在此谢了! 展开
<%
dim sql,rs
sql="select*from mess order by id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
%>
<table width="500" height="200" border="1" align="center">
<%
response.Write "<tr>"
for i=0 to rs.fields.count-1
response.write "<td>"&trim(rs.fields(i).name)&"</td>"
next
response.write "</tr>"
%>
<%
do while not rs.eof
response.Write "<tr>"
for i=0 to rs.fields.count-1
response.Write "<td>"&trim(rs.fields(i).value)&"<td>"
next
rs.movenext
response.Write"</tr>"
loop
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
这是主要代码,能输出数据,但是输出的数据位置不对,对不齐,
谁会帮下忙,在此谢了! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询