<% call TableBegin(sPageHeading,sMessage)%>
<%
'-------- call to paging function -------------
'for default display
strSQL="select * from favors where Name like '%"&rqtextfield&"%' or Categories like '%"&rqtextfield&"%' or Details like '%"&rqtextfield&"%' or Description like '%"&rqtextfield&"%' or Keywords like '%"&rqtextfield&"%'"
sPageName="second.asp"
nPagesize=10
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim strOrderBy 'A fake parameter used to illustrate passing them
Dim strs4QL 'SQL command to execute
Dim iRecordsShown 'Loop controller for displaying just iPageSize records
Dim I 'Standard looping var
Dim rs1
' Get parameters4
iPageSize = cint(nPagesize) ' You could easily allow users4 to change this
' Retrieve page to show or default to 1
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = cdbl(Request.QueryString("page"))
End If
' Open rs
set rs1=server.CreateObject("ADODB.recordset")
rs1.CursorLocation = 3
rs1.Open strSQL,cn,1,3
if not rs1.eof then
rs1.PageSize = iPageSize
' You can change other settings as with any rs44
rs1.CacheSize = iPageSize
' Get the count of the pages using the given page size
iPageCount = rs1.PageCount
' If the request page falls outside the acceptable range,
' give them the closest match (1 or max)
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
' Check page count to prevent bombing when zero results are returned!
' Move to the selected page
rs1.AbsolutePage = iPageCurrent
' Start output with a page x of n line
' Show "previous" and "next" page links which pass the page to view
' and any parameters4 needed to rebuild the query. You could just as
' easily use a form but you'll need to change the lines that read
' the info back in at the top of the script.
dim pageshow
pageshow=""
If iPageCurrent > 1 Then
pageshow="
<< "
End If
pageshow=pageshow &"
Page "&""&"
of "&""
If iPageCurrent < iPageCount Then
pageshow = pageshow & "
>> "
End If
sPaging=pageshow
end if
'---------- Display Records --------------
if not (rs1.EOF) then
For j=1 To nPagesize
if not (rs1.EOF) then
%>
" > border="0">
"><%=rs1("Name")%> |
" class="simplelink"><%=rs1("Description")%>
<%=mid(rs1("Details"),1,200)&"....." %> |
| |
<%
rs1.movenext()
end if
Next
else%>
| Sorry! No result
found with : <%=rqtextfield%> |
<%'Response.Write "We were not able to find any web page that contained" & ":" %>
<%end if
%>
<% call TableEnd()%>