#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    1
    Rep Power
    0

    Question Help: Separating search results; 1|2|3| and so on


    I'm new at ASP and I'm trying to get my search results page to divide up the results so there won't be a lot listed on just one page. This is the only thing I can't figure out. I've tried samples of other code with no luck. Here is my code:

    Code:
    <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    Dim cnn
    Dim str
    Dim search
    Dim rs
    Dim SQL
    
    search = request.form("bgg")
    Set cnn = CreateObject("ADODB.Connection")
    
    str = "Provider=Microsoft.Jet.OLEDB.4.0;"
    str = str & "Data Source=C:\Inetpub\wwwroot\test\test.mdb"
    cnn.ConnectionString = str
    cnn.Open
    
    
    SQL = "Select * From Price where Header Like '%" & search & "%' order by Page"
    Set rs = CreateObject("ADODB.Recordset")
    rs.ActiveConnection = cnn
    rs.Open SQL
    
    (I took out the tables so the code wouldn't be that long on this post)
    
    rs.MoveNext
    Wend
    Response.write str
    Response.write "<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD><center><img src=Pictures\WesServerLogo.gif></center></TD></TR>"
    Response.write "</TABLE></FONT>"
    cnn.close
    </SCRIPT>
    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    138
    Rep Power
    12
    I would love to do all the work for you but It would cost money!

    Instead why don't you try doing a websearch at http://www.google.com for "asp recordset paging" or any other search engine and you will find plenty of examples.

    find one which uses
    rs.AbsolutePage - Specifies in which page the current record resides

    rs.pagesize - The number of records that constitute one page in the Recordset

    rs.pagecount - The number of pages of data the Recordset object contains


    to start on a particular page after openning the rs just go
    rs.AbsolutePage = request("page")
    --

    ngibsonau

IMN logo majestic logo threadwatch logo seochat tools logo