ASP查询 - TOMMYHU - 专注互联网开发及运营技术,提供相关资料及软件下载,奇趣网络时事评论!
Jun 1

ASP查询 不指定

tommyhu , 13:32 , ASP , Comments(0) , Trackbacks(0) , Reads(8289) , Via Original Large | Medium | Small

<%
BigClassName=Trim(request("BigClassName"))
SmallClassName=Trim(request("Smallclassname"))
SmallsmClassName=Trim(request("Smallsmclassname"))
SpecialName=trim(request("SpecialName"))
keyword=trim(request("keyword")[separator][separator])
if keyword<>"" then
  keyword=replace(replace(replace(replace(keyword,"'","‘"),"<","&lt;"),">","&gt;")," ","&nbsp;")
end if
strField=trim(request("Field"))%>



  <%
sqlArticle="select * from Product where Passed=True "
  
  if keyword<>"" then
  sqlArticle="select * from Product where Passed=True and Title like '%" & keyword &"%'"
  end if
  
  if BigClassName<>"" then
    sqlArticle=sqlArticle &" and BigClassName='" & BigClassName &"'"
      if SmallClassName<>"" then
      sqlArticle=sqlArticle & " and SmallClassName='" & SmallClassName & "'"
      if SmallsmClassName<>"" then
        sqlArticle=sqlArticle & " and SmallsmClassName='" & SmallsmClassName & "'"
        end if
      end if
  end if
  sqlArticle=sqlArticle & " order by ArticleID desc"
  'response.Write sqlArticle
  Set rs1= Server.CreateObject("ADODB.Recordset")
  rs1.open sqlArticle,conn,1,1
  'response.Write rsArticle("Title")
  i=0
  rs1.PageSize=12
  page=1
  if Request.QueryString("pg")<>"" then  
        page=Request.QueryString("pg")
        rs1.AbsolutePage=page
  else
     'session("Rs_AbsolutePage")=1    
   if not rs1.Eof then
   rs1.AbsolutePage=1
   end if
  end if
  RowCount =rs1.pagesize
  do while not rs1.eof and RowCount>0
  i=i+1
  %>
                    <td width="603" height="150" align="center" valign="middle" class="dihua">
          
          <table width="124" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="124" height="93" align="left" valign="top"><a href=chanpinxx.asp?ArticleID=<%=rs1("articleid")%>><img src="<%=rs1("DefaultPicUrl")%>" width="122" height="91" class="ttab2" /></a></td>
                      </tr>
                      <tr>
                        <td height="25" align="center" valign="middle"><span class="lm"><%=rs1("Title")%></span></td>
                      </tr>
                    </table></td>
          <%
            
              if i mod 3=0 and i<>0    then
        response.write "</tr><tr>"
        'response.write i
        end if
        %>
        
          <%
          rs1.movenext
        RowCount=RowCount-1
        loop
        
  %>
          
          
          
                  </tr>
                  
                  
                  
                  
                  <tr>
                    <td height="25" align="center" valign="middle" colspan="5"><span class="lm21">共<font color="#ff6262">
                            <%response.write rs1.RecordCount%>
                            </font>个记录 共<font
                  color="#ff6262">
                              <%pagecount=rs1.PageCount
      response.write PageCount
    %>
                              </font>页&nbsp;每页<font
                  color="#ff6262">
                                <% response.write page3count%>
                                </font>条 第<font color="#ff6262">
                                <%
   if len(page)=0 then
   response.write "1"
   else
   response.write page
   end if %>
                                </font>页 [<a
                  href="<%response.write "product.asp?pg=1&BigClassName="&BigClassName&"&SmallClassName="&SmallClassName&"&Elite="&Elite&"&tj="&tj&"&EnElite="&EnElite&"&keyword="&keyword&""%>">首页</a>]
                            <%
   if page>1 then
   response.write "<a href='product.asp?pg="&page-1&"&BigClassName="&BigClassName&"&SmallClassName="&SmallClassName&"&Elite="&Elite&"&tj="&tj&"&EnElite="&EnElite&"&keyword="&keyword&"'>[上一页]</a>"
    end if
    %>
                                <%
   if int(page)<int(pagecount) then
   response.write "<a href='product.asp?pg="&page+1&"&BigClassName="&BigClassName&"&SmallClassName="&SmallClassName&"&Elite="&Elite&"&tj="&tj&"&EnElite="&EnElite&"&keyword="&keyword&"'>[下一页]</a>"
   end if
  
  
   %>
                            [<a
                  href="<%response.write "product.asp?pg="&pagecount&"&BigClassName="&BigClassName&"&SmallClassName="&SmallClassName&"&Elite="&Elite&"&tj="&tj&"&EnElite="&EnElite&"&keyword="&keyword&""%>">末页</a>]</span></td>
                  </tr>

▲返回顶部
Last modified by tommyhu on2009/06/01 14:03

Add a comment

Nickname

emotemotemotemotemotemotemotemotemotemotemotemotemotemotemotemot