*/ ----------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- -----------------------
*/from:Jianzheng State http://www.jzxue.com
*/著者:Tianyaは雨を聞く電子メール:[email protected]:809252803
*/時間:2007-10-6プログラミングフォーラム最初のローンチ
*/声明:著者の労働を尊重してください、この段落にテキストを保管してください
*/ ----------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- -----------------------
<%
'名前:百万データ練習
著者:Tianyaは雨を聞きます
'時間:2007年10月6日
'プラットフォーム:Win2000+IIS5.0+SQL2000
'Affiller:初めてのように単純に使用してください。
'------------------------------------------------------------- ---------------------------------------------接続データベース
Response.buffer = true
dim sqllocalname、sqlusername、sqlpassword、sqldatabas
Dim Connstr、Conn
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '
sqllocalname =(local) '接続IP [ローカル(ローカル)IP IP IP]
sqlusername = sa 'データベースユーザー名
sqlpassword = xxxxxx 'ユーザーパスワード
sqldatabasename = news2008 'データベース名
connstr = sqloledb;
'' '' '' '' '' '' '' '' '' '' '' '' '' '
エラーの再開時に次に再開します
conn = server.createObject(adodb.connection)を設定します
conn.open connstr
エラーの場合
err.clear
conn =何も設定しません
Response.write <div style = 'font-size:14px;
Response.End
ifを終了します
'------------------------------------------------------------- ---------------------------------------------接続完了するデータベース
'変数を定義します
'fldname-conty-countx-totalのフィールド名
'strsql-total実行ステートメント
dim tblname、fldname、fieldname、pagesizex、pagecountx、pageno、ordretype、strwhere
dim strsql、fieldcount、strtmp、strororder、topfield
'
pageno = trim(request.querystring(pageno))
is -numeric(pageno)またはpageno = then 'ページ値がない場合、初期化値
pageno = abs(pageno)
pageno = 0の場合、pageno = 1
それ以外
pageno = 1
ifを終了します
tblname = tablenews
fldname = id 'は、データベースでソートフィールド値を繰り返すことができないことを示しています。
fieldname = id、title、addtime
pagesizex = 30
OrderType = 1 '0-IS ORDER 1リットルです
strwhere =(code = '0101')および(hits> 100) '注:条件が使用されている場合()二重括弧
topfield =(pageno-1)*pagesizex'top
Orderype = 0の場合
strtmp = <(select min
stroreder = by [&fldname&] desc
それ以外
strtmp =>(maxを選択します
stroreder = by [&fldname&] asc
ifを終了します
'SQLステートメントを定義します
strsql = top&clng(pagesizex)&fieldname&from&tblname&
pageno = 1の場合、 '最初のページの場合は、次のコードを実行してライブラリを高速に確認します
strwhere <> thenの場合
strsql = strsql&where&strshere&strorder&
それ以外
strsql = strsql&strorder
ifを終了します
それ以外
strwhere <> thenの場合
strsql = strsql&where&fldname&strtmp&(&fldname&)from(select top&clng(topfield)&fldname&frm&tblname&str. r。
それ以外
strsql = strsql&where&fldname&strtmp&(&fldname&)from(select top&clng(topfield)&fldname&tblname&strrener&as tbltmp)&stronger&
ifを終了します
ifを終了します
rs = const.execute(strsql) 'クエリを実行します
rs.bofとrs.eofの場合
conn.close:set conn = nothing
respons.write <スクリプト言語= 'javascript'> alert( '現在、レコードは見つかりません、再手術に戻ってください! "); history.go(-1); </script>
Response.End
ifを終了します
strwhere <> then ''総記録を求めている場合
fieldcount = conn.execute(&tblname&strwhere&)(0)(0)from&tblname&strwhere&select count(&fldname&)
それ以外
fieldcount = conn.execute(&tblname&)(0)からcount(&fldname&)を選択
ifを終了します
if(fieldcount mod npagesize)> 0 then '合計ページ番号pagecountxを見つける
pagecountx =(fieldcount-(fieldcount mod pagesizex))/ pagesizex +1
それ以外
pagecountx =(fieldcount / pagesizex)
ifを終了します
'データを表示します
rs.eofではありません
Response.write&rs && nbsp;
rs.movenext
ループ
'関連するリソースをオフにしてリリースします
rs.close
conn.close:set conn = nothing
'ページングを表示します
pageno <= 1の場合
Response.write <font color = '#ff0000'> [Homepage] [前] </font>
それ以外
Response.write [<a href = '?ターゲット=' _ seld '> <font color ='#ff0000 '> home </font> </a>]
Response.write [<a href = '?&'ターゲット= '_ seld' title = '前ページ'> <font color = '#ff0000'> >]]
ifを終了します
pageno> = pagecountxの場合
Response.write <font color = '#ff0000'> [次のページ] [テールページ] </font>
それ以外
Response.write [<a href = '?&'ターゲット= '_ seld' title = 'next page'> <font color = '#ff0000'> < /font> < /a> ]
Response.write [<a href = '?&pagecountx&' target = '_ self' title = 'test page'> <font color = '#ff0000'>テールページ</font> </a>]
ifを終了します
Response.write [ページオーダー<font color = red>&pageno&</font>ページ/common <font color = red>&pagecountx&</font>ページ]
Response.write [Total <font color = red>&fieldcount&</font> entry <font color = red>&pagesizex&</font> Strip/Page]
response.write:<select name = 'page' size = '1' onchange = javascript :windo.location = '?
i = 1からpaycountxの場合
respons.write <オプション値=&i&
pageno = iの場合、response.write selectd
respons.write(> no.-&i&-page </option>)
次
respons.write </selectd>
%>