From learning to using ASP, many programs have been written, but the most troublesome thing is writing data paging. Long code will make the program readability worse, and you will start using some paging functions that are available online. So, do you know the steps to create a general paging class of ASP? Let’s follow the editor of the Wrong New Technology Channel to learn more!
1. The goal of creating a paging class
Before writing, I thought about what kind of class I wanted to write. When I recalled the past when writing the paging process, the most annoying thing was which piece of complex paging code I had to write every time. The biggest worry was that each time was the difference between just a few variable names. So the first thing to achieve is to encapsulate this, the second is to encapsulate the navigation bar of the pagination. The third is to encapsulate the data display part by not being used to. This is not convenient to program, and for users whose display effects are different each time, it is more troublesome than writing paging by themselves. So my goal is to make some simple encapsulation of RecordSet.
2. Creation process
So the first property I wrote is to return a processed RecordSe
Public Property Get GetRs()Set XD_Rs=Server.createobject("adodb.recordset")
XD_Rs.PageSize=PageSize
XD_Rs.Open XD_SQL,XD_Conn,1,1
If not(XD_Rs.eof and XD_RS.BOF) Then
If int_curpage>XD_RS.PageCount Then
int_curpage=XD_RS.PageCount
End If
XD_Rs.AbsolutePage=int_curpage
End If
Set GetRs=XD_RS
End Property