ตัวอย่างของรหัสเพจ
<%'' ชื่อไฟล์ของโปรแกรมนี้คือ: pages.asp%>
<%'' มีไฟล์ตารางค่าคงที่ ADO ADOVBS.INC ซึ่งสามารถคัดลอกได้จากไดเรกทอรี "ProgramFiles/CommonFiles/System/ADO">
<!-#includefile = "adovbs.inc"->
<%''* สร้างการเชื่อมต่อฐานข้อมูลนี่คือฐานข้อมูล Oracle8.05
setConn = server.createObject ("adodb.connection"))
conn.open "ผู้ให้บริการ = msdaora.1; dataSource = yoursrcname; userId = yourUserId; รหัสผ่าน = yourpassword;"
setRs = server.createObject ("adoDB.RecordSet") '' สร้างวัตถุ RecordSet
Rs.CursorLocation = aduseclient '' ชุดแอตทริบิวต์การตั้งค่าการตั้งค่าตัวชี้
'' * ตั้งจำนวนบันทึกทั้งหมดภายในหน้าและสามารถปรับได้ตามต้องการ
Rs.Pagesize = 10
'' * คำสั่ง Query
strsql = "selectid, ชื่อ, ที่อยู่, โทรศัพท์จากที่อยู่หนังสือ orderbyid"
Rs.Openstsql, Conn, Adopenstatic, Adlockreadonly, AdcmdText
-
<html>
<head>
<title> ตัวอย่างเพจ </title>
<scriptLanguage = JavaScript>
// ตอบกลับเมื่อคลิก "[หน้าแรก]"::
FunctionPageFirst ()
-
document.myform.currentPage.selectedIndex = 0;
document.myform.currentpage.onchange ();
-
// ตอบกลับเมื่อคลิก "[หน้าก่อนหน้า]"::
FunctionPagePrior ()
-
document.myform.currentPage.SelectedIndex--;
document.myform.currentpage.onchange ();
-
// ตอบกลับเมื่อคลิก "[หน้าถัดไป]"::
functionpagenext ()
-
document.myform.currentPage.SelectedIndex ++;
document.myform.currentpage.onchange ();
-
// ตอบกลับเมื่อคลิก "[หน้าสุดท้าย]"::
functionpagelast ()
-
document.myform.currentPage.selectedIndex = document.myform.currentPage.length -1;
document.myform.currentpage.onchange ();
-
// การตอบสนองเมื่อเลือก "หน้า?"
functionpagecurrent ()
{//pages.asp เป็นชื่อไฟล์ของโปรแกรมนี้
document.myform.action = 'pages.asp? page ='+(document.myform.currentPage.selectedIndex+1)
document.myform.submit ();
-
</script>
</head>
<bodybgcolor = "#ffffcc" link = "#008000" vlink = "#008000" ลิงก์ = "#ff0000" ">
<%ifrs.eofthen
response.write ("<fontsize = 2color =#000080> [ไม่มีบันทึกในฐานข้อมูล!] </font>")
อื่น
'' ระบุหมายเลขหน้าปัจจุบัน
ifrequest ("currentPage") = "" แล้ว
Rs.absolutePage = 1
อื่น
Rs.absolutePage = CLNG (คำขอ ("CurrentPage")))
endif
'' สร้าง Form MyForm วิธีรับ
Response.write ("<formMethod = getName = myForm>")
response.write ("<palign = center> <fontsize = 2color =#008000>")
'' ตั้งค่าการเชื่อมโยงหลายมิติ
ifrs.pagecount = 1 จากนั้น
Response.write ("[หน้าแรก] [หน้าก่อนหน้า] [หน้าถัดไป] [หน้าสุดท้าย]")
อื่น
ifrs.absolutepage = 1 จากนั้น
Response.write ("[หน้าแรก] [หน้าก่อนหน้า]")