手机
当前位置:查字典教程网 >编程开发 >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编程常用的代码

ASP实现长文章分页

ASP实现URL编码

asp实现的7xi音乐网的采集源代码

asp连接sqlserver数据库实现代码

[ASP]精华代码

asp实现批量录入数据的实现

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

实现ASP程序执行时间统计类的代码

精品推荐
分类导航