Use the next article in the record in the database (ii)
Source: Internet
Author: User
Ii. use of bookmark (bookmark)
The bookmark (bookmark) makes a mark on a record of the recordset.
When used, move to that piece of data and give the Bookmark property a name, which is the name of the bookmark, and when you want to go back to that record, set the Bookmark property to the name of the bookmark mark you set.
Example of a bookmark
How do I use a bookmark (bookmark)? Let's look at an example of using a bookmark in an ASP code.
For example, ASP code rs13.asp as follows:
<%
Set conn1 = Server.CreateObject ("ADODB. Connection ")
<% if session ("position") < rs2. RecordCount-1 then%>
<a href=rs13.asp?sel=next> Next </A>
<% End If%>
<a href=rs13.asp?sel=last> last article </A>
<a href=rs13.asp?sel=set> Set bookmark</a>
<a href=rs13.asp?sel=go> to Bookmark</a>
<% rs2. Close%>
The bookmark (bookmark) Position of the user's recordset is stored by session ("BK"), and the bookmark is set by <a href=rs13.asp?sel=set> when the [set bookmark] Super connection is pressed. </A>, sets the SEL to set, and executes the rs13.asp ASP code again. From the following program part, first rs2. Move session ("position") returns to its last position and then uses session ("BK") = rs2. Bookmark is set, and session ("bookmark") stores the name of the bookmark mark:
If Request ("sel") = "Last" Then
Rs2. MoveLast
ElseIf Request ("sel") = "Then"
Rs2. MoveFirst
ElseIf Request ("sel") = "Prev" Then
Session ("position") = Session ("position")-1
Rs2. Move session ("position")
ElseIf Request ("sel") = "Next" Then
Session ("position") = Session ("position") + 1
Rs2. Move session ("position")
ElseIf Request ("sel") = "Set" Then
Rs2. Move session ("position")
Session ("BK") = rs2. Bookmark
ElseIf Request ("sel") = "Go" Then
Rs2. Bookmark = Session ("BK")
Else
Session ("position") = 0
End If
When the [to bookmark] Super connection is pressed, the <a href=rs13.asp?sel=go> to Bookmark</a>, the SEL is set to go, and the rs13.asp ASP code is executed again. By the above part of the program, by RS2. Bookmark = Session ("BK") returns to the location of the last bookmark mark.
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