JSEMTS搜尋引擎
 


'**************************************
' for :Advanced SQL Query Builder
'**************************************
Copyright (C) 1999, Lewis Moten. All rights reserved. Any modifications must be sent to me so that I may review and add them to the procedure as I feel fit.
'**************************************
' Name: Advanced SQL Query Builder
' Description:This code lets visitors to
' your site perform complex queries. Users
' may choose if specific words (or phrases
' ) must or must not match - or if they ar
' e optional (default).
' By: Lewis Moten
'
'
' Inputs:asFieldsAry - An array of field
' names in database to search.
asKeywords - The actual query that the user types to query the database.
Keyword Search Parameters
To find fields that may have a word in them
OR roger
| roger
roger
To find fields that must match a word
AND roger
+ roger
& roger
To find fields that must not match a word
NOT roger
- roger
Also use phrases
+"rogers dog" -cat
+(rogers dog)
'
' Returns:Returns just the SQL arguments
' within a group that are to be places aft
' er the WHERE Clause.
'
'Assumes:It is assumed that the user kno
' ws how to build an array of field names
' and understand that syntax of SQL querie
' s along with how to connect to databases
' . This procedure has only been tested wi
' th SQL Servers and Access databases.
'
'Side Effects:This function uses the Reg
' Exp object that was introduced in vbScri
' pt 5.0 that came out with Internet Explo
' rer 5.0. The vbScript can be installed w
' ithout installing Internet Explorer by g
' oing to the subdirectory "Scripting" on
' the microsoft site.
'This code is copyrighted and has limite
' d warranties.
'Please see http://www.Planet-Source-Cod
' e.com/xq/ASP/txtCodeId.6297/lngWId.4/qx/
' vb/scripts/ShowCode.htm
'for details.
'**************************************

Function BuildQuery(ByRef asFieldAry, ByVal asKeyWords)
Dim loRegExp ' Regular Expression Object (requires vbScript 5.0)
Dim loRequiredWords ' Words that MUST match within a search
Dim loUnwantedWords ' Words that MUST NOT match within a search
Dim loOptionalWords ' Words that AT LEAST ONE must match
Dim lsSQL ' Arguments of SQL query that is returned (WHERE __Arguments___)
Dim lnIndex ' Index of an array
Dim lsKeyword ' Keyword or Phrase being worked with
' An error may occur within your script
' Even if you do not call this function
' If you do not have vbScript 5.0 installed on your server
' because of the next line.

' Create regular Expression
Set loRegExp = New RegExp
' Match more then once
loRegExp.Global = True

' Every letter is created equal (uppercase-lowercase = same)
loRegExp.IgnoreCase = True
' pull out keywords and phrases that MUST match within a search
loRegExp.Pattern = "((AND|[+&])\s*[\(\[\{""].*[\)\]\}""])|((AND\s|[+&])\s*\b[-\w']+\b)"
Set loRequiredWords = loRegExp.Execute(asKeywords)
asKeywords = loRegExp.Replace(asKeywords, "")
' pull out keywords and phrases that MUST NOT match within a search
loRegExp.Pattern = "(((NOT|[-])\s*)?[\(\[\{""].*[\)\]\}""])|(((NOT\s+|[-])\s*)\b[-\w']+\b)"
Set loUnwantedWords = loRegExp.Execute(asKeywords)
asKeywords = loRegExp.Replace(asKeywords, "")
' pull out keywords and phrases that must have AT LEAST ONE match within a search
loRegExp.Pattern = "(((OR|[|])\s*)?[\(\[\{""].*[\)\]\}""])|(((OR\s+|[|])\s*)?\b[-\w']+\b)"
Set loOptionalWords = loRegExp.Execute(asKeywords)
asKeywords = loRegExp.Replace(asKeywords, "")
' If at least 1 required word was found
If Not loRequiredWords.Count = 0 Then

' REQUIRED

' Open a new group
lsSQL = lsSQL & "("

' loop through each keyword/phrase
For lnIndex = 0 To loRequiredWords.Count - 1
' Pull the keyword out
lsKeyword = loRequiredWords.Item(lnIndex).Value
' Strip boolean language
loRegExp.Pattern = "^(AND|[+&])\s*"
lsKeyword = loRegExp.Replace(lsKeyword, "")
loRegExp.Pattern = "[()""\[\]{}]"
lsKeyword = loRegExp.Replace(lsKeyword, "")

' Double Quote Keyword
lsKeyword = Replace(lsKeyword, "'", "''")
' If we are not working with the first keyword
If Not lnIndex = 0 Then

' append logic before the keyword
lsSQL = lsSQL & " AND "

End If ' Not lnIndex = 0

' Append SQL to search for the keyword within all searchable fields
lsSQL = lsSQL & "(" & Join(asFieldAry, " LIKE '%" & lsKeyword & "%' OR ") & " LIKE '%" & lsKeyword & "%')"
Next ' lnIndex

' Close the group
lsSQL = lsSQL & ")"
End If ' Not loRequiredWords.Count = 0
' If at least 1 optional word was found
If Not loOptionalWords.Count = 0 Then
' OPTIONAL
' If the SQL query is not yet defined
If lsSQL = "" Then

' Open a new group
lsSQL = "("

' Else SQL query has content
Else

' Append logic before the group
lsSQL = lsSQL & " AND ("

End If ' lsSQL = ""
' loop through each keyword/phrase
For lnIndex = 0 To loOptionalWords.Count - 1
' Pull the keyword out
lsKeyword = loOptionalWords.Item(lnIndex).Value
' Strip Boolean Language
loRegExp.Pattern = "^(OR|[|])\s*"
lsKeyword = loRegExp.Replace(lsKeyword, "")
loRegExp.Pattern = "[()""\[\]{}]"
lsKeyword = loRegExp.Replace(lsKeyword, "")

' Double Quote the keyword
lsKeyword = Replace(lsKeyword, "'", "''")

' If we are not working with the first keyword
If Not lnIndex = 0 Then

' Append Logic before the keyword search
lsSQL = lsSQL & " OR "

End If ' Not lnIndex = 0

' Append SQL to search for the keyword within all searchable fields
lsSQL = lsSQL & "(" & Join(asFieldAry, " LIKE '%" & lsKeyword & "%' OR ") & " LIKE '%" & lsKeyword & "%')"
Next ' lnIndex

' Close the group
lsSQL = lsSQL & ")"

End If ' Not loOptionalWords.Count = 0
' If at least 1 Unwanted word was found
If Not loUnwantedWords.Count = 0 Then
' UNWANTED
' If the SQL query is not yet defined
If lsSQL = "" Then

' Open a new group
lsSQL = "("

' Else SQL query has content
Else

' Append logic before the group
lsSQL = lsSQL & " AND NOT ("

End If ' lsSQL = ""
' loop through each keyword/phrase
For lnIndex = 0 To loUnwantedWords.Count - 1
' Pull the keyword out
lsKeyword = loUnWantedWords.Item(lnIndex).Value
' Strip Boolean Language
loRegExp.Pattern = "^(NOT|[-])\s*"
lsKeyword = loRegExp.Replace(lsKeyword, "")
loRegExp.Pattern = "[()""\[\]{}]"
lsKeyword = loRegExp.Replace(lsKeyword, "")

' Double Quote the keyword
lsKeyword = Replace(lsKeyword, "'", "''")
' If we are not working with the first keyword
If Not lnIndex = 0 Then
' Append Logic before the keyword search
lsSQL = lsSQL & " OR "
End If ' Not lnIndex = 0

' Append SQL to search for the keyword within all searchable fields
lsSQL = lsSQL & "(" & Join(asFieldAry, " LIKE '%" & lsKeyword & "%' OR ") & " LIKE '%" & lsKeyword & "%')"
Next ' lnIndex

' Close the group
lsSQL = lsSQL & ")"
End If ' Not loUnwantedWords.Count = 0
' If arguments were created
If Not lsSQL = "" Then

' Encapsilate Arguments as a group
' in case other aguments are to be appended
lsSQL = "(" & lsSQL & ")"

End If ' Not lsSQL = ""

' Return the results
BuildQuery = lsSQL
End Function ' BuildQuery






搜尋引擎讓我們程式搜尋結果更加完美
  • 如果您覺得該文件有幫助到您,煩請按下我
  • 如果您覺得該文件是一個一無是處的文件,也煩請按下我

  • 搜尋引擎該文件您看起來是亂碼嗎?您可以切換編碼方式試試看!ISO-8859-1 | latin1 | euc-kr | euc-jp | CP936 | CP950 | UTF-8 | GB2312 | BIG5 |
    搜尋引擎本文件可能涉及色情、暴力,按我申請移除該文件

    搜尋引擎網址長?按我產生分享用短址

    ©2026 JSEMTS

    https://tw.search.yahoo.com/search;_ylt=A8tUwYgkQU1YcXoAUE9r1gt.;_ylc=X1MDMjExNDcwNTAwMwRfcgMyBGZyA3lmcC10LTkwMC10dwRncHJpZAMxWU5tY2FYMVFGQ2ZvUXZGN1N0bzVBBG5fcnNsdAMwBG5fc3VnZwMwBG9yaWdpbgN0dy5zZWFyY2gueWFob28uY29tBHBvcwMwBHBxc3RyAwRwcXN0cmwDBHFzdHJsAzQ4BHF1ZXJ5AyVFNiVBRCVBMSVFNiVBRCU4QyUyMCVFNSVCMCU4OCVFNiU4MyU4NSVFNSU5QyU5OAR0X3N0bXADMTQ4MTQ1Nzk3Ng--?p=%E6%AD%A1%E6%AD%8C+%E5%B0%88%E6%83%85%E5%9C%98&fr2=sb-top-tw.search&fr=yfp-t-900-tw&rrjfid=5882975 https://tw.search.yahoo.com/search;_ylt=A8tUwZJ2QE1YaVcAUmFr1gt.;_ylc=X1MDMjExNDcwNTAwMwRfcgMyBGZyA3lmcC10LTkwMC1zLXR3BGdwcmlkAwRuX3JzbHQDMARuX3N1Z2cDMARvcmlnaW4DdHcuc2Vhc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SU5QyU5OAR0X3N0bXADMTQ4MTQ1Nzk3Ng--?p=%E6%AD%A1%E6%AD%8C+%E5%B0%88%E6%83%85%E5%9C%98&fr2=sb-top-tw.search&fr=yfp-t-900-tw&rrjfid=6015353 https://tw.search.yahoo.com/search;_ylt=A8tUwZJ2QE1YaVcAUmFr1gt.;_ylc=X1MDMjExNDcwNTAwMwRfcgMyBGZyA3lmcC10LTkwMC1zLXR3BGdwcmlkAwRuX3JzbHQDMARuX3N1Z2cDMARvcmlnaW4DdHcuc2VhcmNoLnlhaG9vLmNvbQRwb3MDMARwcXN0cgMEcHFzdHJsAwRxc3RybAM4NARxdWVyeQMlRTglQjYlODUlRTUlOEYlQUYlRTYlODQlOUIlRTclOUElODQlRTUlQUYlQjYlRTUlQUYlQjYlMjAlRTglODMlQTElRTUlQUUlODklRTUlQTglOUMEdF9zdG1wAzE0ODE0NTc3OTM-?p=%E8%B6%85%E5%8F%AF%E6%84%9B%E7%9A%84%E5%AF%B6%E5%AF%B6+%E8%83%A1%E5%AE%89%E5%A8%9C&fr2=sb-top-tw.search&fr=yfp-t-900-s-tw&rrjfid=8513183 https://tw.search.yahoo.com/search;_ylt=A8tUwZJ2QE1YaVcAUmFr1gt.;_ylc=X1MDMjExNDcwNTAwMwRfcgMyBGZyA3lmcC10LTkwMC1zLXR3BGdwcmlkAwRuX3JzbHQDMARuX3N1Z2cDMARvcmlnaW4DdHcuc2VhcmNoLnlhaG9vLmNvbQRwb3MDMARwcXN0cgMEcHFzdHJsAwRxc3RybAM4NARxdWVyeQMlRTglQjYlODUlRTUlOEYlQUYlRTYlODQlOUIlRTclOUElODQlRTUlQUYlQjYlRTUlQUYlQjYlMjAlRTglODMlQTElRTUlQUUlODklRTUlQTglOUMEdF9zdG1wAzE0ODE0NTc3OTM-?p=%E8%B6%85%E5%8F%AF%E6%84%9B%E7%9A%84%E5%AF%B6%E5%AF%B6+%E8%83%A1%E5%AE%89%E5%A8%9C&fr2=sb-top-tw.search&fr=yfp-t-900-s-tw&rrjfid=2608235 [前往]歸檔星球9438[教學] 中華電信Hinet數據機(光世代、小烏龜)登入帳號密碼Sex8Rw2828[前往][分享] PUA五步陷阱Mathpixart[前往]fundrichplaymobilinfo[前往]C2088[教學] Windows 10 Wifi 斷線問題解決[前往][前往]LINE MEcteehxwltw[前往]Kteamor-estoretexturemaker[教學] Youtube影片下載方式[技術] 將 Win11 「 右鍵選單 」 變 Win10 版本wp.kmucosmedtcu[前往][前往][前往]Steamemag.hu518[前往][前往]PpxclubcustomsYya28[前往]VocusgjtaiwanHD.Clubnfumcae.nfu[前往]28wdqIWOPopSdsdsoft[前往][教學] 瀏覽器書籤簡易密碼產生器http://archivestar.isgre.at/?site=1[前往]cnabankchbshuuemura[前往]http://jplop52.softether.net/[前往]skillshop.exceedlms[前往]opentix[前往]Mamaclubflexpower[前往]Ssjyw[前往]Twitter[資訊] 遠端桌面技術比較[前往]cgmh[前往]navallihillintel[前往][教學] 允許匿名連入網路芳齡[前往]aiinvest.sinotradenetwork-support.gogorozhanshaoyiroc-taiwan[前往]shufaii[前往]sunhochindict.revised.moecht-pt[教學] AJAX範例本文搜尋本文搜尋blogolizeFlashdown365ingtienasicsNewhigo[前往]Katfile[前往][前往]hk01Ysponder歸檔星球[前往]jinhappyebooks-cctshoppingflat[前往][前往][資訊] 詭異的電話號碼Teasg[前往]web.piapp[前往]god123[前往]boardmixhttp://kserver3.asuscomm.com/[前往][前往]simba[技術] Chrome瀏覽器使用公共解析Public DNS[前往]searchyuanshuo[前往][分享] 全虛擬化 vs. 半虛擬化(PV vs. FV)mosdevelopers.googleICloud99kuboeslitetwitws[教學] 系統還原出現錯誤0X81000203解決mojimhills-selectplaystationcasetify[前往]Tiancaisq[教學] 移除WPS OFFICE教學Jplopsoft[前往][前往]mitackbto70f[前往][前往]wwwcreative[資訊] 已遭駭客外洩之郵件帳號密碼[教學] 台男悲歌2022[技術] Excel插入很多照片(jpg)後變非常卡Meworks[前往][前往]gu-global[前往]smctw密碼安全檢測工具密碼安全檢測工具Quyushujuwisechipfittechdaughtersynopsys[前往][資訊] 嘆氣會令幸福跑掉artkaojiIceDrivelingyetraining[分享] 批次檔模擬VB6框架taitronicsTucaptionsOdyseeCodePengreenpeace[分享] 安倍晉三槍擊真相PixnetGm6699Post76crusalisyyoofiiisindamallbuy.gamergzpu[教學] 執行檔簽名方式sfworldwide[前往]richseafoodhawkgaugetesla[教學] MATS顯示卡測試工具OurSOGO[前往]03shuoamtop[前往]businessweeklyHottown[前往][前往][前往]Rock8899findyourstampsvaluesanmin[前往][教學] 關閉打開IE瀏覽器強制跳轉EDGE瀏覽器oolabtwKiss69lg[前往][資訊] 中國監獄網軍證據(強迫囚犯為政府洗地)hurrybuyangle[前往]Cfbwzbmwpttwebappleroc-taiwan[資訊] 顯示卡天梯2021drunkelephant[前往]elearn.video.nccuhcltechsw[前往][前往][前往][前往]animate-onlineshophttp://jplop32.asuscomm.com/LineaGemXiuwushidaidungdongthai-kinXiangtoushu[教學] 字串去除尾巴工具cde[前往]OnMyOjiGameCitytalkbxlm100Zyblshttp://karsten2024.softether.net/[前往]paulaschoiceMmluna2starrocketthaprobaniannostalgiaaversi.ge[前往]xinhaolian[前往][技術] 解決Excel開啟後出現空白畫面(灰色畫面)okapi.booksdigiwinXintangtceosasc[前往]Orangeonline貸款貸款[前往]SeafishzoneO4ooo[前往][前往]http://archives.rf.gd/iuprice[前往]intertek-twn[前往][前往]Hamiltonchinese52printlewdreview.spacehackmd1[前往]anime1[前往][前往]bochk[前往]blogdomago2022olderkle64VKLaosucourses[前往]amy6622[前往]kobold-vorwerktaiwanshop[前往][前往]Ky58menge[教學] 三眼表模擬器(計時碼錶模擬器)世界之眼 blogspot世界之眼 blogspotgomaji[前往]RctwIT TOP Blog