asp取数据问题

toaking 2006-08-17 11:17:43
我对asp不是很熟,大家帮我看下代码。数据库中只有14条。但我3个一行,最后一格没有就会出错
看看怎么解决
<!--#include file="init.asp"-->
<%
key_txt = ReplaceStr(Request.QueryString("key_txt"),0)
mymenu = "product"
myurl = "product.asp"
mytitle = "产品中心"
menuUrl = "product.asp?keyno="
pageUrl = "product_list.asp?key_txt="& key_txt &"&keyno="&keyno&"&pageno="
basclass = 11
mywebtype = 9
pagesize = 4
%>
<!--#include file="myasp_article.asp"-->
<%
wheretxt=" and pid="& id
if trim(key_txt)<>"" then wheretxt=" and title like '%"& key_txt &"%'"
sql="select id,title,picflag,content,creatdate from product3 where cnflag=1"& wheretxt &" order by xuhao"
rs.Open sql,cn,1,1
if not rs.EOF then
rs.PageSize=pagesize
pagecount=rs.PageCount
if pageno<1 then pageno=1
if pageno>pagecount then pageno=pagecount
rs.AbsolutePage=pageno
recordcount=rs.RecordCount
else
pagecount=0
recordcount=0
end if
i=0
do while not rs.EOF and i<pagesize
i=i+1
curdate=rs("creatdate")
url="view.asp?prono="&rs("id")&""" target=""_blank"
%>
<table height="120"><tr>

<td width="150">
<div align="center">
<table width="96%" border="0" cellpadding="00" cellspacing="0" class="link1">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="90" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="90" height="90" border="0"></a></td>
<%else%>
<td width="90" height="90" align="center" bgcolor="ffffff"><font color=666666>暂无图片</font></td>
<%end if%>
</tr>
<tr><td><font color="#666666"><strong><a href="<%=url%>"><font color="986A01"><%=cutstr(rs("title"),8,0)%></font></a></strong></td></tr>
</table>
</div>
</td>
<%rs.movenext%>

<td width="150">
<div align="center">
<table width="96%" border="0" cellpadding="00" cellspacing="0" class="link1">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="90" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="90" height="90" border="0"></a></td>
<%else%>
<td width="90" height="90" align="center" bgcolor="ffffff"><font color=666666>暂无图片</font></td>
<%end if%>
</tr>
<tr><td><font color="#666666"><strong><a href="<%=url%>"><font color="986A01"><%=cutstr(rs("title"),8,0)%></font></a></strong></td></tr>
</table>
</div>
</td>
<%rs.movenext%>

<td width="150">
<div align="center">
<table width="96%" border="0" cellpadding="00" cellspacing="0" class="link1">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="90" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="90" height="90" border="0"></a></td>
<%else%>
<td width="90" height="90" align="center" bgcolor="ffffff"><font color=666666>暂无图片</font></td>
<%end if%>
</tr>
<tr><td><font color="#666666"><strong><a href="<%=url%>"><font color="986A01"><%=cutstr(rs("title"),8,0)%></font></a></strong></td></tr>
</table>
</div>
</td>

</tr></table>

<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<%
rs.movenext
loop
rs.close
%>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td>
<td >共有 <%=recordcount%> 条记录</td>
<td height="30" align="right"><a href="<%=pageUrl&pageno-1%>">上一页</a> <%=pageno%>/<%=pagecount%> <a href="<%=pageUrl&pageno+1%>">下一页</a></td>
<td width="20"></td>
</tr>
</table>
<table width="96%" height="8" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center" height="30"> </td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<!--#include file="end.asp"-->
...全文
145 3 打赏 收藏 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
toaking 2006-08-17
  • 打赏
  • 举报
回复
up
明珠佩佩 2006-08-17
  • 打赏
  • 举报
回复
照我这个试试看

<table align="center" width="90%" style="font-size:9pt">
<tr>
<td align="center" height="24" width="40%">
<%
Dim i
i = 0
While not rs.eof%>
<input type="checkbox" name="UnitArray" value="<%= rs(2)%>"><%=rs(1)%>
<%
i = i + 1
if i mod 3 = 0 then response.Write("<br>")
rs.MoveNext
Wend
set rs = Nothing%>
</td>
</tr>
</table>
hebhd 2006-08-17
  • 打赏
  • 举报
回复
<%if not rs.eof then exit do%>
<%rs.movenext%>
这样做。不过版式你再自已调整吧

28,402

社区成员

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

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