ASP recordset)

Source: Internet
Author: User

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
%>

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: info-contact@alibabacloud.com 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.