Speaking of search, I believe everyone is familiar with it, because we can often use this tool in our normal work, but how can our programmers achieve it on the Internet? Today is the ASP implementation intelligent search implementation code introduced by the editor of the new technology channel.
<%
Function AutoKey(strKey)
Const lngSubKey=2
lngLenKey=Len(strKey)
Select Case lngLenKey
Case 0 'If it is an empty string, go to the error page
Response.Redirect "Error.htm"
Case 1 'If the length is 1, no value is set
strNew1=""
strNew2=""
Case Else 'If the length is greater than 1, start from the first character of the string and loop to take the substring with length 2 as the query condition
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
'Get the complete SQL statement
AutoKey="Select * from T_Sample where U_Name like '%" & strKey & "%' Or U_Info like '%" & strKey & "%'" & strNew1 & strNew2
End Function
%>
ASP’s implementation of intelligent search implementation code, the editor of Wuxin Technology Channel has introduced it to you here. More technical knowledge is in Wuxin Technology Channel!