分行问题

深圳还是一样的深圳 2009-08-24 10:47:51
如何分几行显示


<%
strSQL = "SELECT * FROM Products_id WHERE PJ = 1 AND Pid like '" & rs("Pid") & "%' ORDER BY [ID]"
SET rs1 = Conn.Execute(strSQL)
If Not (rs1.EOF AND rs1.BOF) Then

Do While Not rs1.EOF

%>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>


<td width="100%" height="29" align="left" valign="top"><table width="64" height="29" cellpadding="0" cellspacing="0" background="images/about_menu_1.gif">
<!--DWLayoutTable-->
<tr>
<td width="64" height="29" align="center" valign="middle"><a href="guoleiyou.asp?s=<%= rs1("Pid") %>" target="_self" class="menuyou_link_3"><%= rs1("PName") %></a></td>
</tr>
</table> </td>
<td width="1" height="29" align="left" valign="top"></td>


</tr>

</table>

<%
rs1.MoveNext
Loop


End If
rs1.Close():SET rs1 = Nothing
%>
...全文
155 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
never exists 2009-08-24
  • 打赏
  • 举报
回复
不行的话 循环tr
  • 打赏
  • 举报
回复
我加了FOR 循环,

设定一行显示十条, 如果总数只有十八条时,就出错了,

也就说显示到十八条时,还在查找记录,提示记录被删除等信信息






<table width="64" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->






<tr>

<%
strSQL = "SELECT * FROM Products_id WHERE PJ = 1 AND Pid like '" & rs("Pid") & "%' ORDER BY [ID]"
SET rs1 = Conn.Execute(strSQL)
If Not (rs1.EOF AND rs1.BOF) Then

Do While Not rs1.EOF
aaa=1
for i = 1 to 10
%>

<td width="64" height="29" align="left" valign="top"><table width="64" height="29" cellpadding="0" cellspacing="0" background="images/about_menu_1.gif">
<!--DWLayoutTable-->
<tr>
<td width="64" height="29" align="center" valign="middle">


<a href="shengneiyou.asp?s=<%= rs1("Pid") %>" target="_self" class="menuyou_link_3" ><%= rs1("PName") %></a></td>
</tr>
</table> </td>
<td width="1" height="29" align="left" valign="top"></td>


<%

rs1.MoveNext


aaa=aaa+1

next

Response.Write "</tr>"

Loop


End If

rs1.Close():SET rs1 = Nothing
%>

</tr>





</table>




liuwei_IT_love 2009-08-24
  • 打赏
  • 举报
回复
<%
strSQL = "SELECT * FROM Products_id WHERE PJ = 1 AND Pid like '" & rs("Pid") & "%' ORDER BY [ID]"
SET rs1 = Conn.Execute(strSQL)
If Not (rs1.EOF AND rs1.BOF) Then
%>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<%
Do While Not rs1.EOF
%>
<tr>

<td width="100%" height="29" align="left" valign="top"> <table width="64" height="29" cellpadding="0" cellspacing="0" background="images/about_menu_1.gif">
<!--DWLayoutTable-->
<tr>
<td width="64" height="29" align="center" valign="middle"> <a href="guoleiyou.asp?s= <%= rs1("Pid") %>" target="_self" class="menuyou_link_3"> <%= rs1("PName") %> </a> </td>
</tr>
</table> </td>
<td width="1" height="29" align="left" valign="top"> </td>
</tr>
<%
rs1.MoveNext
Loop
%>
</table>

<%
End If
rs1.Close
SET rs1 = Nothing
%>

关闭连接这样写就行,没必要那么复杂

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧