ASP 多关键词查询实例代码
程序员文章站
2023-01-25 07:58:07
程序代码: 以下为引用的内容: 复制代码 代码如下:'关键字的搜索 str="select * from tablename where id>4" if srhke...
程序代码:
以下为引用的内容:
'关键字的搜索
str="select * from tablename where id>4"
if srhkey<>"" then
keyarr=split(srhkey," ")
j=ubound(keyarr)
t=0
dim keystrarr()
for i=0 to j
if keyarr(i)<>"" then
redim preserve keystrarr(t)
strfilter="(empzw like '%"&keyarr(i)&"%' or empdep like '%"&keyarr(i)&"%' or empgz like '%"
strfilter=strfilter&keyarr(i)&"%' or empwy1 like '%"&keyarr(i)&"%' or empwy2 like '%"&keyarr(i)
strfilter=strfilter&"%' or empyq like '%"&keyarr(i)&"%' or com_name like '%"&keyarr(i)&"%')"
keystrarr(t)=strfilter
t=t+1
end if
next
keystr=join(keystrarr," and ")
str=str&" and "&keystr
end if
以下为引用的内容:
复制代码 代码如下:
'关键字的搜索
str="select * from tablename where id>4"
if srhkey<>"" then
keyarr=split(srhkey," ")
j=ubound(keyarr)
t=0
dim keystrarr()
for i=0 to j
if keyarr(i)<>"" then
redim preserve keystrarr(t)
strfilter="(empzw like '%"&keyarr(i)&"%' or empdep like '%"&keyarr(i)&"%' or empgz like '%"
strfilter=strfilter&keyarr(i)&"%' or empwy1 like '%"&keyarr(i)&"%' or empwy2 like '%"&keyarr(i)
strfilter=strfilter&"%' or empyq like '%"&keyarr(i)&"%' or com_name like '%"&keyarr(i)&"%')"
keystrarr(t)=strfilter
t=t+1
end if
next
keystr=join(keystrarr," and ")
str=str&" and "&keystr
end if
上一篇: asp ajax跨域提交数据