<% @ Language = VBSCRIPT %>
<% Option Explicit %>
<%
Rem uses getrows in asp to implement code for database record paging.
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
Response. Write "Viewing" & iOffset & "records starting at record" & iStart & "<BR>"
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
Dim aResults
AResults = objRS. GetRows
ObjRS. Close
Set objRS = Nothing
ObjConn. Close
Set objConn = Nothing
Dim iRows, iCols, iRowLoop, iColLoop, iStop
IRows = UBound (aResults, 2)
ICols = UBound (aResults, 1)
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
%>