关于 rs.recordcount
<%setrs=server.CreateObject("adodb.recordset")rs.open"select*FROMBJX_class2orderbyanc...
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * FROM BJX_class2 order by anclassid",conn,1,1
if rs.recordcount=0 then
response.write "<br>目前没有商品分类"
else
while not rs.eof
%>
<tr>
<td height="30" valign="middle" bgcolor="#fff3c7" style="font-weight:bold; font-size:14px"> <a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs("nclassid")%>" class="nav"><font color="#333333"><%=rs("nclass")%></font></a>(
<%
dim sqlTotal
dim rsTotal,totalPut
sqlTotal="select Count(*) from BJX_goods where nclassid=nclassid "
Set rsTotal= Server.CreateObject("ADODB.Recordset")
rsTotal.open sqlTotal,conn,1,1
if rsTotal.eof and rsTotal.bof then
totalPut=0
response.write " 0 "
else
totalPut=rsTotal(0)
response.Write " " & totalPut & " "
end if
rsTotal.close
set rsTotal=nothing
%>)
想实现左边是分类,右边是同一分类下的品牌数,但是现在读到的是总记录数,怎么才能实现我想要的功能? 展开
set rs=server.CreateObject("adodb.recordset")
rs.open "select * FROM BJX_class2 order by anclassid",conn,1,1
if rs.recordcount=0 then
response.write "<br>目前没有商品分类"
else
while not rs.eof
%>
<tr>
<td height="30" valign="middle" bgcolor="#fff3c7" style="font-weight:bold; font-size:14px"> <a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs("nclassid")%>" class="nav"><font color="#333333"><%=rs("nclass")%></font></a>(
<%
dim sqlTotal
dim rsTotal,totalPut
sqlTotal="select Count(*) from BJX_goods where nclassid=nclassid "
Set rsTotal= Server.CreateObject("ADODB.Recordset")
rsTotal.open sqlTotal,conn,1,1
if rsTotal.eof and rsTotal.bof then
totalPut=0
response.write " 0 "
else
totalPut=rsTotal(0)
response.Write " " & totalPut & " "
end if
rsTotal.close
set rsTotal=nothing
%>)
想实现左边是分类,右边是同一分类下的品牌数,但是现在读到的是总记录数,怎么才能实现我想要的功能? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询