1. Create A recordset object
CopyCode The Code is as follows: 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 objectCopy codeThe Code is as follows: dim strsql
Strsql = "select * From ietable"
Objmyrst. oepn strsql, activeconnection, ad1_text
3. Set the pagesize attribute of recordsetCopy codeCode: objmyrst. pagesize = 20
The default pagesize is 10.
4. Set the absolutepage attribute of recordset
Reference content is as follows:Copy codeThe Code is as follows: dim intcurrentpage
Intcurrentpage = 1
Objmyrst. absolutepage = intcurrentpage
Absolutepage is the pagecount value of the 1 to recordset object.
5. Display DataCopy codeThe Code is as follows: Response. Write ("<Table> ")
Printfieldname (objmyrst)
For I = 1 to objmyrst. pagesize
Printfieldvalue (objmyrst)
Objmyrst. movenext
If objmyrst. EOF then exit
Next
Response. Write ("</table> ")
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 inProgramMediumCopy codeThe Code is as follows: <! -- # Include file = "adovbs. inc" -->
2. the code for printfielname and printfieldvalue functions is as follows: copy Code the code is as follows: <%
function printfieldname (objmyrst)
'parameter objmyrst Is A recordset object
'defines the number of partitions
dim obj1_< br> response. write ""
for each obj1_in objmyrst. fields
response. write "" & objtasks. name & ""
next
response. write ("")
end function
function printfieldvalue (objmyrst)
'parameter objmyrst Is A recordset object
'defines the number of partitions
dim obj1_< br> response. write ("")
for each obj1_in objmyrst. fields
'response. write "" & objmyrst. fields (intloop ). value & ""
response. write "" & objtasks. value & ""
next
response. write ("")
end function
%>