Solved

Spliting search reasults - asp

Posted on 2004-08-24
6
264 Views
Last Modified: 2010-04-17
Hi experts,

could you tell me how to display search results on different pages? For example, one result on one page. What is the code that I must insert? Im using ASP to do the coding.
0
Comment
Question by:blurSoul
  • 4
  • 2
6 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 11878594
0
 
LVL 33

Accepted Solution

by:
sajuks earned 125 total points
ID: 11878596
//code by  thunderchicken
<html><head>
<title>Paging of a Recordset</title>
</head><body>

<%
intPage = Request("page")
If isNumeric(intPage) = False Or intPage < 1 Then
    intPage = 1
End If

Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT LinkURL FROM Links"
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("/aspdigital/db/demo.mdb")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
    rs.PageSize = 10
    rs.AbsolutePage = intPage
    intRecCount = rs.PageSize
    intPageCount = rs.PageCount
    Response.Write "<p><b>Side " & intPage & " af " & intPageCount & "</b></p>"
    Do While Not rs.EOF And intRecCount > 0
        Response.Write rs("LinkURL") & "<br>"
     intRecCount = intRecCount - 1
     rs.MoveNext
    Loop
End If
rs.Close
Set rs = Nothing

Response.Write "<p>Here "
For intNum = 1 To intPageCount
    Response.Write "<a href=paging.asp?page=" & intNum & ">" & intNum & "</a> "
Next

Response.Write "<p>"
If Cint(intPage) > 1 Then
    Response.Write "<a href=paging.asp?page=" & intPage - 1 & ">&lt;&lt;</a>"
Else
    Response.Write "&lt;&lt;"
End If

Response.Write "&nbsp;"

If CInt(intPage) < Cint(intPageCount) Then
    Response.Write "<a href=paging.asp?page=" & intPage + 1 & ">&gt;&gt;</a> "
Else
    Response.Write "&gt;&gt;"
End If
%>

</body></html>
0
 

Author Comment

by:blurSoul
ID: 11878624
lol thats a lot of code. Are all needed? I've already opened recordset and all...

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 33

Expert Comment

by:sajuks
ID: 11878891
Its one thats been used.
Hang around and you might get better ones :-)
0
 

Author Comment

by:blurSoul
ID: 11888751
I think I'll just use it as you said it has been used. Believe it works.

Thanks for your help ;>
0
 
LVL 33

Expert Comment

by:sajuks
ID: 11888990
Thanks for the points and grade
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question