ASP implementation of Intelligent Search Implementation code _ Application techniques
Source: Internet
Author: User
<%
Function AutoKey (strkey)
Const lngsubkey=2
Lnglenkey=len (strkey)
Select Case Lnglenkey
Case 0 ' If empty string, go to 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 with the first character of the string, and iterate over 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 & '% '" &A mp StrNew1 & StrNew2
End Function
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service