ASP paging display recordset data

Source: Internet
Author: User

1. Creating a Recordset object

Dim Objmyrst

Set objmyrst=server.createobject ("ADODB. Recordset ")

Objmyrst.cursorlocation=aduseclientbatch ' client can be processed in batches

Objmyrst.cursortype=adopenstatic ' cursor type is static type

Note: The Recordset object cannot be established with a set Objmyrst=connection.excute strSQL statement because the Recordset object it creates is adopenfowardonly does not support recordsets paging

2. Open a Recordset object

Dim strSql
strSql=”select * from ietable”
objMyRst.Oepn strSql,ActiveConnection,,,adCmdText

3. Set the PageSize property of a recordset


The default pagesize is 10

4. Set the AbsolutePage property of a recordset

Dim Intcurrentpage



AbsolutePage is a PageCount value of 1 to the Recordset object

5. Display data

For i=1 To objMyRst.PageSize
If objMyRst.Eof Then Exit For


1. Adopenstatic,adusecilentbatch,adcmdtext for defined constants, to use the words to copy to the current directory and included in the program

<!--#Include File=””-->
2. PrintFielName,PrintFieldValue函数的代码如下:

Function PrintFieldName(objMyRst)
Dim objFld
Response.Write "<tr bgcolor='#CCCCCC'>"
For Each objFld In objMyRst.Fields
Response.Write "<td>" & objFld.Name & "</td>"
End Function
Function PrintFieldValue(objMyRst)
Dim objFld
Response.Write("<tr >")
For Each objFld In objMyRst.Fields
'Response.Write "<td>" & objMyRst.Fields(intLoop).value & "</td>"
Response.Write "<td>" & objFld.value & "</td>"
End Function

Related Article

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: 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.