解讀用asp編寫類似搜索引擎功能的代碼(2)_ASP教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:揭秘解決殺毒軟件誤刪asp文件的方法
      一些殺毒軟件經(jīng)常會把某些asp文件當成病毒刪除,有時簡直防不勝防,程序莫名其妙的就不能用了,因為少了文件呀~~。這主要是因為,殺毒軟件將某些asp代碼當成木馬關鍵詞,記錄保存著,所以遇到有這個關鍵詞,就會禁止運行或刪除。 解決的方法是將這些關鍵詞給


       ’ 搜索Summary字段  
       sql = sql & " ) OR ( [Summary] LIKE ’%" & QueryWords( 0 ) & "%’" 
       For i = LBound( QueryWords ) + 1 to UBound( QueryWords ) 
        If QueryWords( i ) <> "" and UCase( QueryWords(i) ) <> "OR" and UCase( QueryWords(i) ) <> "AND" Then 
         If uCase( QueryWords( i-1 ) ) = "OR" Then 
          sql = sql & " OR [Summary] LIKE ’%" & QueryWords( i ) & "%’" 
         Else 
          sql = sql & " AND [Summary] LIKE ’%" & QueryWords( i ) & "%’" 
         End If 
        End If 
       Next 

       sql = sql & " )" 


          ’  
          Set rs = Server.CreateObject("ADODB.Recordset") 
          rs.Open sql, conn, 3, 3      
           
          Response.Write "<BR><B> 你搜索的是: </B> " & QueryString     
           
          Response.Write "<BR><B> 搜索的關鍵字: </B> " 
       For i = LBound( QueryWords ) to UBound( QueryWords ) 
        Response.Write "<BR>" & strIndent & i & ": " & QueryWords( i ) 
       Next 

          ’ Print the SQL String 
          Response.Write "<BR><B> sql 語句 : </B> " & sql 
        
       ’ Print the Results 
          Response.Write "<BR><B> 結(jié)果    : </B> <UL>" 
       On Error Resume Next 
       rs.MoveFirst 
       Do While Not rs.eof 
        Response.Write "<BR>" & "<A HREF=’OpenPage.asp?IndexURL=" & rs.Fields("URL").Value & "’>" & rs.Fields("Title") & "</A> - "  
        Response.Write rs.Fields("Description") & "<BR>" 
        Response.Write "     <FONT SIZE=2>URL: " & rs.Fields("URL") & "</FONT>" 
        Response.Write "<HR SIZE=1 WIDTH=200 ALIGN=LEFT>" 
        rs.MoveNext 
       Loop 
       Response.Write "</UL>" 
        
      end if    
      %> 


      </BODY> 
      </HTML> 
       

      分享:揭秘17個ASP編程基礎典型代碼
      1.ASP取得表格輸入數(shù)據(jù)的方法:GETPOST 一.get:用戶端將數(shù)據(jù)加到URL后,格式為”?字段1=輸入數(shù)據(jù)1字段2=輸入數(shù)據(jù)2...,再將其送到服務器。如:action為www.abc.com,字段Name輸入數(shù)據(jù)為jack,字段age的數(shù)據(jù)為15,則用get方法為http://www.abc.com?Name=jackAge=

      共2頁上一頁12下一頁
      來源:模板無憂//所屬分類:ASP教程/更新時間:2010-02-25
      相關ASP教程