请给我写一段asp搜索代码,谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/21 18:56:11

<%
function seach(tab,fie,num)'tab为检索的数据表,fie为检索的字所有字段,num为检索的数据
tj=""
str="select * from ["&tab&"]"
zd=split(fie,",")
sj=split(num,",")
for j=0 to ubound(sj)
if sj(j)<>"" then
tj=" where "
end if
next
str=str&tj
for i=0 to ubound(sj)
if i=0 then
if sj(i)<>"" then
str=str&zd(i)&" like '%"&sj(i)&"%'"
end if
else
if sj(i)<>"" then
for w=0 to i-1
if sj(w)<>"" then
lj=" and "
end if
next
str=str&lj&zd(i)&" like '%"&sj(i)&"%'"
end if
end if
next
seach=str
end function
%>

不懂要搜什么