Position:Home>web development> ASP handles much keyword to inquire example code
ASP handles much keyword to inquire example code
From;  Author:Stand originally
Often encounter much keyword to inquire to single field in Web development, I come true commonly through dynamic array. Of course of many keywords is commonly use blank space or, separate, I this a few hypothesis many keywords are separated with blank space, key word string is KeyStr, specific code is.

Program code:

The search of ' key wordStr= "select * From TableName Where Id>4 "If SrhKey<>"" ThenKeyArr=split(srhKey, "" )J=UBound(keyArr)T=0Dim KeystrArr()For I=0 To JIf KeyArr(i)<>"" ThenRedim Preserve KeystrArr(t)Strfilter= "(empZw Like '%" &keyArr(i)&"%' Or EmpDep Like '%" &keyArr(i)&"%' Or EmpGz Like '% "Strfilter=strfilter&keyArr(i)&"%' Or EmpWy1 Like '%" &keyArr(i)&"%' Or EmpWy2 Like '%" &keyArr(i)Strfilter=strfilter&"%' Or EmpYq Like '%" &keyArr(i)&"%' Or Com_name Like '%" &keyArr(i)&"%') "KeystrArr(t)=strfilterT=t 1End IfNextKeystr=join(keystrArr, "And " )Str=str&"And " &keystrEnd If


Previous:Asp creates the function of Sql statement automatically according to expressing
Next:no article