ASP in the implementation of the GetRows database records pagination of a piece of code _ Application skills
Source: Internet
Author: User
<%@ Language = VBSCRIPT%>
<% Option Explicit%>
<%
REM A section of code that implements database record paging through GetRows in ASP
Dim IStart, Ioffset
IStart = Request ("Start")
Ioffset = Request ("Offset")
If not IsNumeric (IStart) or Len (IStart) = 0 Then
IStart = 0
Else
IStart = CInt (IStart)
End If
If not IsNumeric (Ioffset) or Len (ioffset) = 0 Then
Ioffset = 30
Else
Ioffset = Cint (Ioffset)
End If
Dim objconn, objRS
Set objconn = Server.CreateObject ("ADODB. Connection ")
' objConn.Open ' Dsn=mp3 '
Dim connstr
Dim db
db= "Csnjimageman.mdb"
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("&db&")
objconn. Open ConnStr
Set objRS = Server.CreateObject ("ADODB. Recordset ")
Objrs.open "SELECT * from Imageinfo", objconn
If irows > (ioffset + iStart) Then
Istop = Ioffset + iStart-1
Else
Istop = irows
End If
For irowloop = IStart to Istop
For icolloop = 0 to Icols
Response.Write Aresults (Icolloop, Irowloop) & ""
Next
Response.Write "<BR>"
Next
Response.Write "<P>"
If IStart > 0 Then
' Show Prev link
Response.Write "<a href=" "Getrows.asp? Start= "& Istart-ioffset & _
"&offset=" & Ioffset & "" ">previous" & Ioffset & "</A>"
End If
If Istop < irows Then
' Show Next link '
Response.Write "<a href=" "Getrows.asp? Start= "& Istart+ioffset & _
"&offset=" & Ioffset & "" ">next" & Ioffset & "</A>"
End If
%>
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.