ASP でのインテリジェントな検索機能の実装は、誰もが学ぶのに便利です<%
関数 AutoKey(strKey)
Const lngSubKey=2
lngLenKey=Len(strKey)
大文字と小文字を選択してください lngLenKey
Case 0 '空文字列の場合はエラーページに移動します
Response.RedirectError.htm
ケース 1 '長さが 1 の場合、値を設定しない
strNew1=
strNew2=
Case Else '長さが 1 より大きい場合、文字列の最初の文字から開始し、長さ 2 の部分文字列をクエリ条件としてループします。
i=1 の場合、lngLenKey-(lngSubKey-1) へ
strSubKey=Mid(strKey,i,lngSubKey)
strNew1=strNew1 & または U_Name のような '% & strSubKey & %'
strNew2=strNew2 & または U_Info のような '% & strSubKey & %'
次
エンドセレクト
'完全な SQL ステートメントを取得します
AutoKey=Select * from T_Sample where U_Name like '% & strKey & %' または U_Info like '% & strKey & %' & strNew1 & strNew2
終了機能
%>