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
<