function autokey(strkey)
const lngsubkey=2
lnglenkey=len(strkey)
select case lnglenkey
case 0 '若为空串,转到出错页
response.redirect "error.htm"
case 1 '若长度为1,则不设任何值
strnew1=""
strnew2=""
case else '若长度大于1,则从字符串首字符开始,循环取长度为2的子字符串作为查询条件
for i=1 to lnglenkey-(lngsubkey-1)
strsubkey=mid(strkey,i,lngsubkey)
strnew1=strnew1 & " or u_name like '%" & strsubkey & "%'"
strnew2=strnew2 & " or u_info like '%" & strsubkey & "%'"
next
end select
'得到完整的sql语句
autokey="select * from t_sample where u_name like '%" & strkey & "%' or u_info like '%" & strkey & "%'" & strnew1 & strnew2
end function
%>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!