主頁(yè) > 知識(shí)庫(kù) > ASP 相關(guān)文章或者相關(guān)產(chǎn)品

ASP 相關(guān)文章或者相關(guān)產(chǎn)品

熱門標(biāo)簽:Mysql連接數(shù)設(shè)置 團(tuán)購(gòu)網(wǎng)站 阿里云 科大訊飛語(yǔ)音識(shí)別系統(tǒng) 銀行業(yè)務(wù) Linux服務(wù)器 電子圍欄 服務(wù)器配置
在后臺(tái)添加中一般我們都設(shè)置了一個(gè)“關(guān)鍵字”,而且一般輸入可能如下:
娃娃,毛絨娃娃,日本充氣娃娃
我們將根據(jù)這個(gè)來(lái)做,具體實(shí)現(xiàn)如下:
先看一條SQL語(yǔ)句:
復(fù)制代碼 代碼如下:

select top 3 sid,sname from product where keywords like '%娃娃%' or keywords like '%毛絨娃娃%' or keywords like '%日本充氣娃娃%'

那么我們根據(jù)這條語(yǔ)句就可以搜索到相關(guān)產(chǎn)品或者相關(guān)文章了(其實(shí)有更復(fù)雜以及更好的實(shí)現(xiàn),但這里暫時(shí)不提及了),以下是關(guān)鍵代碼:
復(fù)制代碼 代碼如下:

%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
% Response.Charset="gb2312" %>
%
Dim A:A = "娃娃,毛絨娃娃,日本充氣娃娃"

'obj為值,filed為字段名
Function sqlKeyWord(obj,field)
Dim temp:temp = split(obj,",")
For i = 0 To ubound(temp)
sqlKeyWord = sqlKeyWord field" like '%"temp(i)"%' or "
Next
sqlKeyWord = left(sqlKeyWord,len(sqlKeyWord)-3)
End Function

Dim mysql:mysql = "select top 3 sid,sname from product where " + sqlKeyWord(A,"keywords")
Response.Write(mysql)
'Set objRs = objConn.execute(mysql)
'Do while not objRs.Eof
'Response.Write(objRs("sname"))
'Loop

'objRs.close
'set objRs = nothing
'objConn.close
'set objConn = nothing
%>

標(biāo)簽:棗莊 萍鄉(xiāng) 大理 衢州 江蘇 蚌埠 廣元 衡水

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP 相關(guān)文章或者相關(guān)產(chǎn)品》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266