找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 45|回复: 2

关键字搜索问题 急!!!!!!!!

[复制链接]
发表于 2010-1-10 05:29:42 | 显示全部楼层 |阅读模式 IP:江苏扬州
'=================================================
'过程名:ShowSearchResult
'作  用:分页显示搜索结果
'参  数:无
'=================================================
sub ShowSearchResult()
    if currentpage<1 then
           currentpage=1
    end if
    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
        sqlSearch="select top " & MaxPerPage   
    else
        sqlSearch="select "
    end if

    sqlSearch=sqlSearch & " * from Product where Passed=True "
    if BigClassName<>"" then
        sqlSearch=sqlSearch & " and BigClassName='" & BigClassName & "' "
        if SmallClassName<>"" then
            sqlSearch=sqlSearch & " and SmallClassName='" & SmallClassName & "' "
        end if   
    end if
    if keyword<>"" then
        select case strField
            case "Title"
                sqlSearch=sqlSearch & " and Title like '%" & keyword & "%' "
            case "Content"
                sqlSearch=sqlSearch & " and Content like '%" & keyword & "%' "
            case else
                sqlSearch=sqlSearch & " and Title like '%" & keyword & "%' "
        end select
    end if
    sqlSearch=sqlSearch & " order by ID desc"
    Set rsSearch= Server.CreateObject("ADODB.Recordset")
    rsSearch.open sqlSearch,conn,1,1
    if rsSearch.eof and rsSearch.bof then
               response.write "<p align='center'><br><br>没有或没有找到任何产品</p>"
       else
           if currentPage=1 then
               call SearchResultContent()
           else
               if (currentPage-1)*MaxPerPage<totalPut then
                   rsSearch.move  (currentPage-1)*MaxPerPage
                   dim bookmark
                   bookmark=rsSearch.bookmark
                   call SearchResultContent()
              else
                currentPage=1
                   call SearchResultContent()
              end if
           end if
       end if
       rsSearch.close
       set rsSearch=nothing   
end sub

sub SearchResultContent()
    dim i,strTemp
    i=0
    do while not rsSearch.eof
        strTemp=""        
        strTemp= strTemp & "<table width=100% border=0 cellspacing=3 cellpadding=0>"
                strTemp= strTemp & "<tr>"
                strTemp= strTemp & "<td width=25% rowspan=6>"
                strTemp= strTemp & "<div align=center><a href=ProductShow.asp?ID=" & rsSearch("ID") & ">"
               
                fileExt=lcase(getFileExtName(rsSearch("DefaultPicUrl")))
                if fileext="jpg" or fileext="bmp" or fileext="png" or fileext="gif" then
                strTemp= strTemp & "<img border=0 src=" & rsSearch("DefaultPicUrl") & " width=105 height=80>"
                else
                 if fileext="swf" then
                    strTemp= strTemp & "<object  classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='105' height='84'>"
                    strTemp= strTemp &"<param name=movie value='"&rsSearch("DefaultPicUrl")&"'>"
                    strTemp= strTemp &"<param name=quality value=high>"
                    strTemp= strTemp &"<param name='Play' value='-1'>"
                    strTemp= strTemp &"<param name='Loop' value='0'>"
                    strTemp= strTemp &"<param name='Menu' value='-1'>"
                    strTemp= strTemp &"<param name='wmode' value='transparent'>"
                    strTemp= strTemp &"<embed src='"&rsSearch("DefaultPicUrl")&"' width='105' height='84' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed> </object>"                                                
               end if
              end if            
                 
                strTemp= strTemp & "</a></div></td>"
                strTemp= strTemp & "<td width=12% height=12>"
                strTemp= strTemp & "产品名称:</td>"
                strTemp= strTemp & "<td>"
                strTemp= strTemp & "<a href=ProductShow.asp?ID=" & rsSearch("ID") & ">" & rsSearch("Title") & ""
                strTemp= strTemp & "</a></td>"
               
                'strTemp= strTemp & "</tr><tr>"
                'strTemp= strTemp & "<td width=12% height=12>"
                'strTemp= strTemp & "产品售价:</td>"
                'strTemp= strTemp & "<td>" & rsSearch("Price") & "元</td>"               
               
                strTemp= strTemp & "</tr><tr>"
                strTemp= strTemp & "<td width=12% height=12>"
                strTemp= strTemp & "产品规格:</td>"
                strTemp= strTemp & "<td>"
                strTemp= strTemp & rsSearch("Spec") & ""
                strTemp= strTemp & "</a></td>"
               
                strTemp= strTemp & "</tr><tr>"
                strTemp= strTemp & "<td width=12% height=12>"
                strTemp= strTemp & "产品备注:</td>"
                strTemp= strTemp & "<td>"
                strTemp= strTemp & rsSearch("Memo") & ""
                strTemp= strTemp & "</a></td>"               
               
                strTemp= strTemp & "</tr><tr>"
                strTemp= strTemp & "<td height=12>"
                strTemp= strTemp & "产品类别:</td>"
                strTemp= strTemp & "<td><a href=Product.asp?BigClassName=" & rsSearch("BigClassName") & ">" & rsSearch("BigClassName") & "</a> → "
                strTemp= strTemp & "<a href=Product.asp?BigClassName=" & rsSearch("BigClassName") & "&SmallClassName=" & rsSearch("SmallClassName") & ">" & rsSearch("SmallClassName") & ""
                strTemp= strTemp & "</a></td>"
                strTemp= strTemp & "</tr><tr>"

               
                strTemp= strTemp & "<td height=12>产品信息:</td>"
                strTemp= strTemp & "<td>"
                strTemp= strTemp & "<a href=ProductShow.asp?ID=" & rsSearch("ID") & "><img src=Img/arrow_7.gif border=0></a></td>"
                strTemp= strTemp & "</tr><tr>"
                strTemp= strTemp & "<td colspan=2>"
                strTemp= strTemp & "<table width=100% border=0 cellpadding=0 cellspacing=0>"
                strTemp= strTemp & "<tr>"
                strTemp= strTemp & "<td width=50% height=12>"
                strTemp= strTemp & "<div align=center></div></td>"
               
                strTemp= strTemp & "<td width=50% height=12>"
                strTemp= strTemp & "<div align=center><input name='Product_Id' type='checkbox'    id='Product_Id' value="&cstr(rsSearch("Product_Id"))&"> 选取"
                strTemp= strTemp & "</div></td>"
               
                strTemp= strTemp & "</tr>"
                strTemp= strTemp & "</table>"
                strTemp= strTemp & "</td>"
                strTemp= strTemp & "</tr><tr>"
                strTemp= strTemp & "<td height=1 colspan=3 bgcolor=#CCCCCC></td>"
                strTemp= strTemp & "</tr>"
                strTemp= strTemp & "</table>"
        response.write strTemp
        rsSearch.movenext
        i=i+1
        if i>=MaxPerPage then exit do   
    loop
end sub

当关键字不输入的时候  会显示没有找到任何产品 我想改成 当无关键字时  显示本小类中全部产品  请问各位大大如何改




谢谢
发表于 2010-1-10 05:29:46 | 显示全部楼层 IP:江苏扬州
sqlSearch=sqlSearch & " order by ID desc"
    Set rsSearch= Server.CreateObject("ADODB.Recordset")
    rsSearch.open sqlSearch,conn,1,1
    if rsSearch.eof and rsSearch.bof then
               response.write "<p align='center'><br><br>没有或没有找到任何产品</p>"
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 11:38 , Processed in 0.209570 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表