1. Create A recordset object
Dim objmyrst
Set objmyrst = server. Createobject ("ADODB. recordset ")
Objmyrst. cursorlocation = aduseclientbatch can be processed in batches by the client.
Objmyrst. cursortype = adopenstatic 'the cursor type is static.
Note: The recordset object cannot be created using the set objmyrst = connection. excute strsql statement, because the created recordset object is adopenfowardonly and does not support record set paging.
2. Open the recordset object
Dim strsql
Strsql = "select * From ietable"
Objmyrst. oepn strsql, activeconnection, ad1_text
3. Set the pagesize attribute of recordset
Objmyrst. pagesize = 20
The default pagesize is 10.
4. Set the absolutepage attribute of recordset
Dim intcurrentpage
Intcurrentpage = 1
Objmyrst. absolutepage = intcurrentpage
Absolutepage is the pagecount value of the 1 to recordset object.
5. Display Data
Response. Write ("
Printfieldname (objmyrst)
For I = 1 to objmyrst. pagesize
Printfieldvalue (objmyrst)
Objmyrst. movenext
If objmyrst. EOF then exit
Next
Response. Write ("
")
Note:
1. adopenstatic, adusecilentbatch, and ad1_text are constants defined by adovbs. Inc. to use them, copy adovbs. Inc to the current directory and include them in the program.
<! -- # Include file = "adovbs. inc" -->
2. The code for printfielname and printfieldvalue functions is as follows:
ASP recordset method attributes
Rs. pagesize = 3 size per page (number of records per page)
Rs. pagecount calculate the number of pages based on the page size and total number of records
Rs. recordcount
Rs. absolutepage current page
Recordset. Fields. Count returns the number of columns in recordset.
Recordset (I). Name returns the name of column I in recordset.
Recordset. rcordcount returns the number of records in recordset.
Recordset (I) returns the column I of the recordset current record.
Recordset. Bookmark returns the set books and materials to store the current records. Recordset. absolutepostition moves the indicator to a certain item in recordset.
Recordset. pagesize: set the number of data records displayed on each page.
Recordset. pagecount returns the total number of pages after pagination.
Recordset. absolutepage returns the current page number.
Recordset ("column name") returns the data content of the specified column name.
Recordset. bof determines whether the indicator has exceeded the top limit.
Recordset. EOF determines whether the indicator exceeds the final level.
Recordset. movefirst move the data recording indicator to the first one.
Recordset. movelast moves the data recording indicator to the last one.
Recordset. movenext moves the data indicator back.
Recordset. moveprevious transfers data indicators one by one.
Recordset. getrows can store data in recordset to the array.
Recordset. addnew adds data to the data table.
Recordset. Update updates the current information.
Recordset. delete Delete the current data.
Recordset. Find find information