·产品展示           您的位置 公司首页 >> 产品展示
<% dim postcs postcs="bigid="&request("bigid")&"&smallid="&request("smallid") dim rs,sql set rs=server.createobject("adodb.recordset") dim sqlcp,smallid,bigid if request("bigid")<>"" then bigid=clng(request("bigid")) else bigid=0 end if if request("smallid")<>"" then smallid=clng(request("smallid")) else smallid=0 end if '因为数值型不能为空,0-9,所以以上转化一下, set rs=server.createobject("adodb.recordset") if bigid=0 then sqlcp="select * from article order by px_id desc" else if smallid=0 then sqlcp="select * from article where bigclassid="&bigid&" order by px_id desc" else sqlcp="select * from article where bigclassid="&bigid&" and smallclassid="&smallid&" order by px_id desc" end if end if '以上条件语句设定当大类,小类有没,各种情况下输出不同的sql语句。 rs.open sqlcp,conn,1,3 if rs.eof then response.write "no product" else %> <% const MaxPerPage=9 dim totalPut dim CurrentPage dim TotalPages dim i dim pagename pagename="product.asp" if not isempty(request("page")) then currentPage=cint(request("page")) else currentPage=1 end if rs.PageSize=MaxPerPage '总的记录数 totalPut=rs.recordcount if currentpage<1 then currentpage=1 end if '防止最后一页记录为空,比如共397条记录,每页40条,当为最后一页(10)时,就会需要如此判断 if (currentpage-1)*MaxPerPage>totalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if if currentPage=1 then showContent showpage totalput,MaxPerPage,pagename else if (currentPage-1)*MaxPerPage <% '显示函数 sub showContent i=1 %>
<% dim rsbigclass,rssmallclass,sqlbigclass,sqlsmallclass set rsbigclass=server.createobject("adodb.recordset") if bigid<>0 then sqlbigclass="select * from bigclass where bigclassid="&bigid rsbigclass.open sqlbigclass,conn,1,1 if not rsbigclass.eof then response.write "" response.write rsbigclass("bigclassname") response.write "" rsbigclass.close set rsbigclass=nothing end if end if set rssmallclass=server.createobject("adodb.recordset") if smallid<>0 then sqlsmallclass="select * from smallclass where smallclassid="&smallid rssmallclass.open sqlsmallclass,conn,1,1 if not rssmallclass.eof then response.write " >>" response.write rssmallclass("smallclassname") response.write "" rssmallclass.close set rssmallclass=nothing end if end if %>
<% dim li do while not rs.eof and (i <% i=i+1 li=li+1 rs.movenext if not rs.eof and (i <% else exit do end if %> <% i=i+1 li=li+1 rs.movenext if not rs.eof and (i <% else exit do end if %> <% li=li+1 if li mod 3=0 then %> <% end if i=i+1 rs.movenext loop %>
<%=rs("wz_title")%>
<%=rs("wz_title")%>
<%=rs("wz_title")%>
 
<% end sub %>