Solved

Spliting search reasults - asp

Posted on 2004-08-24
6
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Progress
Introduction to Processes

691 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