The implementation of intelligent search function under asp is convenient for everyone to learn<%
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.RedirectError.htm
Case 1 'If the length is 1, then do not set any value
strNew1=
strNew2=
Case Else 'If the length is greater than 1, start from the first character of the string and loop through the substring of 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
%>