手机
当前位置:查字典教程网 >编程开发 >ASP教程 >ASP实现智能搜索实现代码
ASP实现智能搜索实现代码
摘要:

<%

FunctionAutoKey(strKey)

ConstlngSubKey=2

lngLenKey=Len(strKey)

SelectCaselngLenKey

Case0'若为空串,转到出错页

Response.Redirect"Error.htm"

Case1'若长度为1,则不设任何值

strNew1=""

strNew2=""

CaseElse'若长度大于1,则从字符串首字符开始,循环取长度为2的子字符串作为查询条件

Fori=1TolngLenKey-(lngSubKey-1)

strSubKey=Mid(strKey,i,lngSubKey)

strNew1=strNew1&"OrU_Namelike'%"&strSubKey&"%'"

strNew2=strNew2&"OrU_Infolike'%"&strSubKey&"%'"

Next

EndSelect

'得到完整的SQL语句

AutoKey="Select*fromT_SamplewhereU_Namelike'%"&strKey&"%'OrU_Infolike'%"&strKey&"%'"&strNew1&strNew2

EndFunction

%>

【ASP实现智能搜索实现代码】相关文章:

实例分析之用ASP编程实现网络内容快速查找的代码

ASP + Serv-u 实现FTP的代码

ASP实现长文章分页

用ASP建立站内搜索

ASP实现URL编码

ASP 微信公共平台接口实现代码

asp中实现随机分组程序的代码

ASP辅助代码

实现对Access数据库表重命名的一段代码

asp FSO 读写文件本文件实现代码

精品推荐
分类导航