Solved

Spliting search reasults - asp

Posted on 2004-08-24
6
236 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now