主頁 > 知識(shí)庫 > ASP中巧用Split()函數(shù)生成SQL查詢語句的實(shí)例

ASP中巧用Split()函數(shù)生成SQL查詢語句的實(shí)例

熱門標(biāo)簽:Mysql連接數(shù)設(shè)置 團(tuán)購網(wǎng)站 阿里云 銀行業(yè)務(wù) 服務(wù)器配置 Linux服務(wù)器 科大訊飛語音識(shí)別系統(tǒng) 電子圍欄

Split 程序代碼

復(fù)制代碼 代碼如下:

%attribs="商場(chǎng)名^^快餐店名^^報(bào)停名"
names=Split(attribs,"^^")
i=0
for each name in names
  response.write names(i)"br>"
  i=i+1
next
%>

程序拆分結(jié)果:
商場(chǎng)名
快餐店名
報(bào)停名

根據(jù) Split 結(jié)果生成 SQL 語句

復(fù)制代碼 代碼如下:

%attribs="商場(chǎng)名^^快餐店名^^報(bào)停名"
names=Split(attribs,"^^")
i=0
sql="select top 10 * from TableName where"
for each name in names
  if names(i)="商場(chǎng)名" then
    sql=sql+" or 商場(chǎng) like '%"names(i)"%'"
  end if
  if names(i)="快餐店名" then
    sql=sql+" or 快餐店 like '%"names(i)"%'"
  end if
  if names(i)="報(bào)停名" then
    sql=sql+" or 快餐店 like '%"names(i)"%'"
  end if
  i=i+1
next
sql=sql+" Ordey by Id DESC"
sql=Replace(sql, "where or", "where")
response.write sql
%>

程序運(yùn)行結(jié)果:

復(fù)制代碼 代碼如下:

select top 10 * from TableName where 商場(chǎng) like '%商場(chǎng)名%' or 快餐店 like '%快餐店名%' or 快餐店 like '%報(bào)停名%' Ordey by Id DESC

您可能感興趣的文章:
  • access數(shù)據(jù)庫的一些少用操作,ASP,創(chuàng)建數(shù)據(jù)庫文件,創(chuàng)建表,創(chuàng)建字段,ADOX
  • ASP ACCESS 日期操作語句小結(jié) By Stabx
  • asp 獲取access系統(tǒng)表,查詢等操作代碼
  • Asp 操作Access數(shù)據(jù)庫時(shí)出現(xiàn)死鎖.ldb的解決方法
  • asp.net(C#) Access 數(shù)據(jù)操作類
  • asp實(shí)現(xiàn)的查詢某關(guān)鍵詞在MSSQL數(shù)據(jù)庫位置的代碼
  • asp 在線備份與恢復(fù)sqlserver數(shù)據(jù)庫的代碼
  • asp終極防范SQL注入漏洞
  • asp連接mysql數(shù)據(jù)庫詳細(xì)實(shí)現(xiàn)代碼
  • asp連接access、sql數(shù)據(jù)庫代碼及數(shù)據(jù)庫操作代碼
  • asp操作access提示無法從指定的數(shù)據(jù)表中刪除原因分析及解決
  • asp執(zhí)行帶參數(shù)的sql語句實(shí)例
  • ASP 連接 SQL SERVER 2008的方法
  • ASP通過ODBC連接SQL Server 2008數(shù)據(jù)庫的方法
  • ASP語言實(shí)現(xiàn)對(duì)SQL SERVER數(shù)據(jù)庫的操作

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

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

    • 400-1100-266