More Good ASP Single Form field multiple conditions Query _ application Skills
Source: Internet
Author: User
Purpose: Article table key word query
Query format: Baidu Google Baidu good or Google good Baidu +google (also can not enter the conditions of all inquiries)
<!--#include file= "conn.asp"-->
<%
Function searshsql (tname,lname,str) ' tname-table name lname-column name str-query characters
If Trim (STR) = "" Then
Mysql= "SELECT * from" &tname
Else
Str=sqlencode (STR) ' preprocessing query string
Arrstr=split (Str, "") ' after the string is separated by a space
Umax=ubound (ARRSTR) ' partition of the upper dimensions of the array to determine the number of keywords divided into
If umax>0 Then ' keywords in the processing of multiple spaces, starting from the 2nd dimension
For I=1 to Umax
STRTEMP=ARRSTR (i)
If Trim (strtemp) = "" "Then strtemp="/~~~~~/"' divided elements into empty special characters instead
Sql=sql & "Or" & Lname & "Like '%" & strtemp & "%"
Next
End If
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.