Paging technology implemented by DreamweaverASP

Source: Internet
Author: User

I am a little excited today. I want to share my "reference on using DW + ASP to implement paging technology" with my friends who are using DW + ASP for web pages. remove the little pain of "first page, last page, next page, last page"

The final display of this effect is: page N [total * page] <1 2 3 4 5 6 7 8 9 10>.

When using DW + ASP for web pages, the following code immediately appears in the code page after the record set is bound:

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server. CreateObject ("ADODB. Recordset ")
Recordset1.ActiveConnection = MM _ database name_string
Recordset1.Source = "SELECT * FROM table name"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open ()

Recordset1_numRows = 0
%>

Now we want to modify the code as follows:

<%
Dim I
Dim RPP
Dim PageNo
I = 1
RPP = 50
PageNo = CInt (Request ("PageNo "))
'The above is the newly inserted,
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server. CreateObject ("ADODB. Recordset ")
Recordset1.ActiveConnection = MM _ database name_string
Recordset1.Source = "SELECT * FROM database name"
Recordset1.CursorType = 1' change the code 0 above to 1.
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open ()
Recordsetasknumrows = 0' then add the following code in the next line of this line:
Recordset1.PageSize = RPP
If PageNo <= 0 Then PageNo = 1
If PageNo> Recordset1.PageCount Then PageNo = Recordset1.PageCount
Recordset1.AbsolutePage = PageNo
Sub ShowPageInfo (tPageCount, cPageNo)
Response. Write "no." & cPageNo & "page [total" & tPageCount & "page]"
End Sub
Sub ShowPageNavi (tPageCount, cPageNo)
If cPageNo <1 Then cPageNo = 1
If tPageCount <1 Then tPageCount = 1
If cPageNo> tPageCount Then cPageNo = tPageCount
Dim NaviLength
NaviLength = 10' NaviLength

<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.