ACCESS数据库调用问题谁帮我解决下呢?

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:51:20
ACCESS数据库调用问题谁帮我解决下呢?

我调用数据库来望站首页,目的是在首页有10个产品放在两行表格内,问题出在这里:if i>=1 then exit do 我把其中的1改为10时,或出现10个产品纵向排列,或出现挤坏其他表格形状。
调用时的代码如下:
<%Dim mark
set
rs=server.CreateObject("adodb.recordset")
rs.open "select top 10 prename,intro,name,id,introduce,pic,price1,price2,discount,makein,mark from product order by adddate desc",conn,1,1
if rs.eof and rs.bof then
response.write "<center><font color=red size=4>对不起,请您先到后台添加商品!</font></font>"
response.End
end if
i=0
do while not rs.eof
%>
<table width="100%" height="240" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" height="100" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpa

试试我修改的代码:10个产品分两行显示,每行显示5个,5个以下则只显示一行.
<%Dim mark
set
rs=server.CreateObject("adodb.recordset")
rs.open "select top 10 prename,intro,name,id,introduce,pic,price1,price2,discount,makein,mark from product order by adddate desc",conn,1,1
if rs.eof and rs.bof then
response.write "<center><font color=red size=4>对不起,请您先到后台添加商品!</font></font>"
response.End
end if %>

<table height="240px" align="center">
<tr>
<%i=1
while not rs.eof
if i<=5 then%>
<td>
<table border="1" width="20%" height="110px">
<tr height="80px">
<td><a href="product.asp?id=<%=rs("id")%>" target="_blank"><img src="<%if trim(rs("pic"))="" then
response.write "images/emp