*/ -------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------ ------------------------------------------------------ ------------------------------------------------------ -------------------
*/จาก: Jianzheng State http://www.jzxue.com
*/ ผู้แต่ง: tianya ฟังอีเมลฝน: [email protected]: 809252803
*/ เวลา: 2007-10-6 การเขียนโปรแกรมเปิดตัวครั้งแรก
*/ คำแถลง: เคารพแรงงานของผู้เขียนโปรดเก็บข้อความไว้ในย่อหน้านี้
*/ -------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------ ------------------------------------------------------ ------------------------------------------------------ -------------------
-
ชื่อ: การปฏิบัติข้อมูลล้าน
'ผู้แต่ง: Tianya ฟังฝน
เวลา: 6 ตุลาคม 2550
'แพลตฟอร์ม: Win2000+IIS5.0+SQL2000
'Affiller: ใช้มันง่ายเหมือนครั้งแรก
'----------------------------------------- ----------------------------------- --------- เชื่อมต่อ ฐานข้อมูล
response.buffer = true
Dim Sqllocalname, Sqlusername, SqlPassword, Sqldatabas
Dim Connstr, Conn
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''
sqllocalName = (local) 'การเชื่อมต่อ IP [local (local) IP IP IP IP]
sqlusername = ชื่อผู้ใช้ฐานข้อมูล SA '
sqlpassword = รหัสผ่านผู้ใช้
SQLDATABASENAME = NEWS2008 'ชื่อฐานข้อมูล
connstr = ผู้ให้บริการ = sqloledb;
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''
เมื่อเกิดข้อผิดพลาดต่อไป
SET Conn = Server.CreateObject (ADODB.Connection)
conn.open connstr
ถ้าเอ่อแล้ว
err.lear
ตั้งค่า conn = ไม่มีอะไร
Response.write <div style = 'Font-Size: 14px;
Response.end
สิ้นสุดถ้า
'----------------------------------------- ----------------------------------- --------- เชื่อมต่อ ฐานข้อมูลให้เสร็จสมบูรณ์
'กำหนดตัวแปร
ชื่อ TBLNAME-TABLE;
คำสั่งการดำเนินการของ Strsql-total;
Dim tblname, fldname, fieldname, pagesizex, pagecountx, pageno, ordretype, strows
Dim Strsql, FieldCount, Strtmp, Strororder, Topfield
-
pageno = trim (request.querystring (pageno)))
ถ้า isnumeric (pageno) หรือ pageno = จากนั้น 'หากไม่มีค่าหน้าค่าเริ่มต้น
pageno = abs (pageno)
ถ้า pageno = 0 แล้ว pageno = 1
อื่น
Pageno = 1
สิ้นสุดถ้า
tblName = tablenews
fldName = id 'แสดงให้เห็นว่าไม่สามารถทำซ้ำค่าฟิลด์การเรียงลำดับในฐานข้อมูล: ขอแนะนำให้คีย์หลัก
fieldName = id, title, addtime
PAGESIZEX = 30
orderType = 1 '0-is คำสั่ง 1 ลิตร
strows = (code = '0101') และ (hit> 100) 'หมายเหตุ: หากมีการใช้เงื่อนไข () วงเล็บสองเท่า ()
topfield = (pageno-1)*pagesizex'top
ถ้า orderype = 0 แล้ว
strtmp = <(เลือกขั้นต่ำ
stroreder = สั่งซื้อโดย [& fldname &] desc
อื่น
strtmp => (เลือกสูงสุด
stroreder = สั่งซื้อโดย [& fldname &] asc
สิ้นสุดถ้า
'กำหนดคำสั่ง SQL
strsql = เลือก top & clng (pagesizex) & fieldname & from & tblname &
หาก pageno = 1 แล้ว 'ถ้าเป็นหน้าแรกให้เรียกใช้รหัสต่อไปนี้เพื่อตรวจสอบไลบรารีอย่างรวดเร็ว
ถ้า strhere <> แล้ว
strsql = strsql & where & strower & strorder &
อื่น
strsql = strsql & strorder
สิ้นสุดถ้า
อื่น
ถ้า strhere <> แล้ว
strsql = strsql & where & fldname & strtmp & (& fldname &) จาก (เลือก top & clng (topfield) & fldname & frm & tblname & strows & str. order &) เป็น tbltmp)
อื่น
strsql = strsql & where & fldname & strtmp & (& fldname &) จาก (เลือก top & clng (topfield) & fldname & tblname & strrener & as tbltmp)
สิ้นสุดถ้า
สิ้นสุดถ้า
ตั้งค่า rs = const.execute (strsql) 'Execute Query
ถ้า Rs.Bof และ Rs.EOF แล้ว
conn.close: ตั้งค่า conn = ไม่มีอะไร
Response.write <script language = 'JavaScript'> การแจ้งเตือน ('ในปัจจุบันไม่พบบันทึกโปรดกลับไปที่การเปิดใหม่! "); history.go (-1); </1)
Response.end
สิ้นสุดถ้า
ถ้า strows <> จากนั้น 'ค้นหาบันทึกทั้งหมด
FieldCount = conn.execute (เลือกนับ (& fldName &) จาก & tblName & strows &) (0) (0)
อื่น
FieldCount = conn.execute (เลือกนับ (& fldName &) จาก & tblName &) (0)
สิ้นสุดถ้า
if (fieldCount mod npagesize)> 0 แล้ว 'ค้นหาหมายเลขหน้าทั้งหมด pagecountx
pageCountx = (FieldCount- (FieldCount Mod Mod PageSizex))/ pagesizex +1
อื่น
pageCountx = (FieldCount / Pagesizex)
สิ้นสุดถ้า
'ข้อมูลการแสดงผล
ทำในขณะที่ไม่ใช่ RS.EOF
Response.write & rs (ชื่อ) && nbsp;
Rs.Movenext
วง
'ปิดและปล่อยทรัพยากรที่เกี่ยวข้อง
Rs.close
conn.close: ตั้งค่า conn = ไม่มีอะไร
'หน้าจอแสดงผล
ถ้า pageno <= 1 แล้ว
Response.write <font color = '#ff0000'> [หน้าแรก] [ก่อนหน้า] </font>
อื่น
Response.write [<a href = '?
Response.write [<a href = '? >]
สิ้นสุดถ้า
ถ้า pageno> = pagecountx แล้ว
Response.write <font color = '#ff0000'> [หน้าถัดไป] [หน้าหาง] </font>
อื่น
Response.write [<a href = '? ]
Response.write [<a href = '?
สิ้นสุดถ้า
Response.write [ลำดับหน้า <font color = red> & pageno & </font> หน้า/สามัญ <font color = red> & pagecountx & </font> หน้า]
Response.write [Total <font color = red> & fieldcount & </font> รายการ <font color = red> & pagesizex & </font> strip/page]
Response.write to: <select name = 'page' size = '1' onChange = JavaScript : window.location = '?
สำหรับ i = 1 ถึง payCountx
response.write <ค่าตัวเลือก = & i &
ถ้า pageno = i แล้วตอบกลับเขียน selectd
Response.write (> No.- & i & -Page </petion>)
ต่อไป
Response.write </selectd>
-