推奨:フィルターを使用して、情報の二次検索を実現します質問について考えてください:最初の検索に基づいて二次検索を実現する方法は?通常、私たちのアプローチは、最初の検索中に検索条件を保存し、2行の検索中に2つの検索条件を組み合わせて、以下などのデータベースで新しいクエリを実行することです。
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'関数関数:HTMLコードをブロックします
'パラメーター:Strinputユーザー入力情報
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
関数funinput(strinput)
そうでない場合は(str)
strinput = cheplage(strinput、<、<)
strinput =置換(strinput、>、>)
strinput =置換(strinput、chr(32)、)
strinput =置換(strinput、chr(34)、)
strinput = epply(strinput、chr(39)、 ')
strinput =置換(strinput、chr(13)、)
funinput = strinput
ifを終了します
エンド関数
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'関数関数:SQL注入を防ぎます
'パラメーター:STRVALUEユーザーがサビされたデータ
'ブロイプデータ型
'パラメーター値:真の数値データ
'誤った文字データ
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
関数funsql(strvalue、blotype)
その場合は、その場合
is -numeric(strvalue)の場合
funsql = clng(strvalue)
それ以外
strvalue = 0
ifを終了します
それ以外
そうでない場合は(strvalue)
strvalue = lcase(strvalue)
strvalue = cheplage(strvalue、 '、' ')
strvalue = cheplage(strvalue、select、)
strvalue =置換(strvalue、update、)
strvalue =置換(strvalue、挿入、)
strvalue = cheplage(strvalue、delete、)
strvalue = cheplage(strvalue、;、)
strvalue = cheplage(strvalue 、、)
strvalue = cheplage(strvalue、chr(255)、)
strvalue = cheplage(strvalue、*、)
strvalue =置換(strvalue、%、)
ifを終了します
ifを終了します
funsql = strvalue
エンド関数
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'関数関数:一般的なタイプ変換
'パラメーター:_Typeデータ型
'_valueデータ
'パラメーター値:_type 1:数値データに変換します
'_type 2:文字データに変換します
'_type 3:ブールデータに変換します
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function funswitch(value_、type_)
エラーの再開時に次に再開します
ケースType_を選択します
ケース1
is -numeric(value_)の場合
そうでない場合(value_)
Funswitch = clng(value_)
それ以外
Funswitch = 0
ifを終了します
それ以外
Funswitch = 0
ifを終了します
ケース2
そうでない場合(value_)
Funswitch = cstr(value_)
それ以外
Funswitch =
ifを終了します
ケース3
そうでない場合は、isnull(value_)およびisnumeric(value_)では
Funswitch = cbool(value_)
それ以外
Funswitch = false
ifを終了します
ケース他のケース
Response.redirect(error.asp?err = Funswitchに転送されるデータ型を指定してください!)
[選択]を終了します
err.number <> 0の場合
Response.redirect(error.asp?err =データ変換中に不明なエラーが発生しました!)
err.clear
ifを終了します
エンド関数
'' ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
'関数関数:データが外部から来るかどうかを確認します
'パラメーター:なし
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function checkfrom()
server_v1 = cstr(request.servervariables(http_referer))
server_v2 = cstr(request.servervariables(server_name))
if mid(server_v1,8、len(server_v2))<> server_v2 then
CheckFrom = true
それ以外
CheckFrom = false
ifを終了します
エンド関数
'' ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
'関数関数:JSプロンプトボックス
'パラメーター:Strurl:[OK]をクリックした後にページアドレスが返されました
'strmsg:ダイアログプロンプト情報
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
関数funmsg(strurl、strmsg)
respons.write <スクリプト言語= 'javascript'>&_
vbcrlf&alert(&strmsg&);&_
vbcrlf&window.location =&strurl&;&_
vbcrlf&</script>
エンド関数
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'関数関数:一般的なページング
'パラメーター:intpagecount合計ページ数
'intmypage Current Page Count
'InterCordCount Total Records
'ページごとに表示されるレコードの数をintpagesizeする
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
関数ファンページ(intpagecount、intmypage、introcordcount、intpagesize)
'次にエラー再開
dim intfor、intlist、intlist_b
DIMクエリ、A、X、温度
action = http://&request.servervariables(http_host)&request.servervariables(script_name)
query = split(request.servervariables(query_string)、&)
クエリの各xに対して
a = split(x、=)
strcomp(a(0)、page、vbtextcompare)<> 0の場合
temp = temp&a(0)&=&a(1)&&&
ifを終了します
次
intmypage> 1の場合
funpage = funpage&<a href = '&action&?&page = 1' title = 'last page' class = 'no'> <font face = 'webdings'> 9 </font> </a>
funpage = funpage&<a href = '&action&?&temp&page =&intmypage-1&' title = 'previous page' class = 'no'> <font face = 'webdings'> 7 </font> </a>
それ以外
funpage = funpage&<font face = 'webdings'> 9 </font>
funpage = funpage&<font face = 'webdings'> 7 </font>
ifを終了します
intlist <> 0の場合
cintmypage = intlistの場合
intlist = intlist 5
ifを終了します
それ以外
intlist = intmypage 5
ifを終了します
intlist-9 <1の場合
intlist_b = 1
それ以外
intlist_b = intlist-9
ifを終了します
intfor = intlist_b to intlist
intfor <= intpagecountの場合
intfor = intmypage then '----現在のページのテキストを赤くし、クリックできない場合
funpage = funpage&strmode&<font color = '#ff0000'> <b>&intfor&</b> </font>
それ以外
funpage = funpage&strmode&<a href = '&action&?&page =&intfor&' class = 'no'>&intfor&</a>
ifを終了します
ifを終了します
strmode = <font color = '#bbbbbb'> | </font>
次
intmypage <intpagecountの場合
funpage = funpage&<a href = '&action&?&temp&page =&intmypage 1&' title = 'last page' class = 'no'> <font face = 'webdings'> 8 </font> </a>
funpage = funpage&<a href = '&action&?&temp&page =&' ittitle = 'last page' class = 'no'> <font face = 'webdings'>:</font> </a>
それ以外
funpage = funpage&<font face = 'webdings'> 8 </font>
funpage = funpage&<font face = 'webdings'>:</font> </a>
ifを終了します
funpage = <table width = '100%' border = '' cellpacing = '0' cellpadding = '0'> <tr>&_
vbcrlf&<td width = '40% 'style = font:14px> current&intmypage&page&intpagesize&list/page total&intpagecount&&&cordcount&list records </td>&_
vbcrlf&<td width = '60% 'align =' right '>&_
vbcrlf&<table width = '360' border = '0' cellpacing = '' cellpadding = '0' cellpadding = '0'> <tr>&_
vbcrlf&<td align = 'right' style = font:14px>&funpage&</td>&_
vbcrlf&</tr> </table> </td> </tr>&_
vbcrlf&</table>
err.number <> 0の場合
err.clear
Response.redirect(error.asp?err =ページネーション関数にエラーがあります。管理者に連絡してください!|)
ifを終了します
エンド関数
'*************************************************
'関数名:ハイライト
'関数:検索キーワードは、強調表示された色で表示されます
'パラメーターstrtextは、強調表示される文字列または変数がある文字列または変数です
'Strfindは、強調表示される文字列または変数です。
'前に強調表示されたHTMLコードプレフィックスは次のようなものです。<font color = red>
'StrafterはHTMLコードの接尾辞を強調しました:</font>
'**********************************************
関数ハイライト(strtext、strfind、strbefore、strafter)
薄暗いnpos
薄暗いnlen
dim nlenall
nlen = len(strfind)
nlenall = nlen len(strbefore)len(strafter)1
highlight = strtext
nlen> 0およびlen(ハイライト)> 0の場合
npos = strunt(1、ハイライト、strfind、1)
NPOS> 0を実行します
ハイライト=左(ハイライト、npos -1)&_
Strbefore&Mid(Highlight、NPOS、NLEN)&Strafter&_
MID(ハイライト、NPOS NLEN)
npos = strunt(npos nlenall、highlight、strfind、1)
ループ
ifを終了します
エンド関数
共有:ASP 3.0高度なプログラミング(31) 7.1.2セマンティックまたはランタイムのエラーの発見と取り扱いは迷惑ですが、プログラミングで本当にエキサイティングな他のタイプのエラー - セマンティックエラー(セマンティックエラー)、または&&ldに遭遇するでしょう