国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ASP實現智能搜索實現代碼

2024-05-04 11:09:23
字體:
來源:轉載
供稿:網友
asp下智能搜索功能的實現,方便大家學習
 
 
 
<% 
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 
%> 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 白沙| 卢湾区| 邻水| 福海县| 灵丘县| 广南县| 肥东县| 宁陵县| 区。| 金川县| 湘乡市| 海南省| 修水县| 正宁县| 德阳市| 定州市| 临清市| 张家川| 海兴县| 龙海市| 兰西县| 泾阳县| 西昌市| 阿尔山市| 盘山县| 蓬溪县| 阜城县| 永川市| 佛坪县| 桓仁| 宁海县| 永康市| 和林格尔县| 城步| 邛崃市| 宜黄县| 德昌县| 萨嘎县| 林甸县| 安乡县| 偃师市|