请教如何生成动态表格??
初学asp,想生成一个3*7的动态表格,单元格262*120,格中显示数据库中address字段的内容。写了个页面,但无法达到预想效果,还望大家指教!
<!--#include file="../function/connect.asp"-->
strsql="select * from Contacts c
Set objRs = Server.CreateObject("adodb.recordset")
objRs.Open strsql,objConn,1,1
<%
if not objrs.eof then
For intLoop = 1 To 7
For interloop =1 to 3
If Not objRs.EOF Then
%>
<td width="252" nowrap><span><%=objrs.fields("Contact_Name")%></span></td>
<%
objRs.MoveNext
End If
Next
%>
<p></P>
<%
Next
else
%>
<tr align="center">
<span class="style1"></span></td>
</tr>
<%end if%>
无法实现重复三次后的换行。如何改正?问题很菜,还望大家指教。
问题点数:60、回复次数:3Top
1 楼myvicy(我来也!)回复于 2005-01-24 18:03:03 得分 15
<!--#include file="../function/connect.asp"-->
strsql="select * from Contacts c
Set objRs = Server.CreateObject("adodb.recordset")
objRs.Open strsql,objConn,1,1
<table>
<%
if not objrs.eof then
For intLoop = 1 To 7
'更改处
response.write "<tr align="center"> "
For interloop =1 to 3
If Not objRs.EOF Then
%>
<td width="252" nowrap><span><%=objrs.fields("Contact_Name")%></span></td>
<%
objRs.MoveNext
End If
Next
'更改处
response.write "</tr>"
Next
else
%>
<tr align="center">
<span class="style1"></span></td>
</tr>
<%end if%>
</table>
替换你的代码,试试
Top
2 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2005-01-24 18:03:44 得分 20
<% for i=1 to 3 %>
<tr>
<% for j=1 to 7 %>
<td>xxxx</td>
<% rs.movenext %>
<% next %>
</tr>
<% next %>Top
3 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2005-01-24 18:04:39 得分 25
忘了写对rs.eof的操作了:(Top





