recordset paging won't show second page

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default recordset paging won't show second page

    Hi I'm querying a database and returning the records using absolute
    page and all that stuff.

    The user can choose to do a keyword search or display all records.
    the page is set up so that the sql statement gets passed back to the
    page using the querystring method.

    This works great when the user selects the display all...i can browse
    through the records perfect....however, when the user enters a keyword
    I get the first page and when i click on next it displays no records
    found....

    the whole sql string is getting passed thru...i did a response.write
    to make sure and it seems intact...

    any help would be greatly appreciated.

    Thanx
    Supaya Guest

  2. Similar Questions and Discussions

    1. Help Recordset paging
      Hi I can't seem to get my recordset navigation bar to work. I am getting the following error:- Variable COUNTRYNAME is undefined. The error...
    2. Help With Recordset paging
      I am trying to set up a website with my honeymoon and wedding picts for everyone to look at. and I am using CFMX to pull photos and captions from a...
    3. Recordset Paging
      Hi there, well, I know how to use this server behavior, but now I've a little problem, I've 3 documents, one to filter the results, one to show the...
    4. default paging, show page nr. text.
      Dear sir, I am using the default paging function of datagrid. Below is my code. <PagerStyle NextPageText="&gt;&gt;&gt;" PrevPageText="&lt;&lt;&lt;"...
    5. paging through recordset
      http://www.google.ca/search?q=asp+recordset+paging+tutorial&ie=UTF-8&oe=UTF-8&hl=en&meta= http://www.asp101.com/articles/recordsetpaging/index.asp...
  3. #2

    Default Re: recordset paging won't show second page

    can u post any code so we can know what's wrong with you program?

    "Supaya" <tonyabishop@hcse.ca> wrote in message
    news:eaf17c37.0404200607.2dd83766@posting.google.c om...
    > Hi I'm querying a database and returning the records using absolute
    > page and all that stuff.
    >
    > The user can choose to do a keyword search or display all records.
    > the page is set up so that the sql statement gets passed back to the
    > page using the querystring method.
    >
    > This works great when the user selects the display all...i can browse
    > through the records perfect....however, when the user enters a keyword
    > I get the first page and when i click on next it displays no records
    > found....
    >
    > the whole sql string is getting passed thru...i did a response.write
    > to make sure and it seems intact...
    >
    > any help would be greatly appreciated.
    >
    > Thanx

    Utada P.W. SIU Guest

  4. #3

    Default Re: recordset paging won't show second page

    >> The error is on line 8
    > How do you know? I didn't post any code
    Exactly

    Cheers
    Ken

    "Supaya" <tonyabishop@hcse.ca> wrote in message
    news:eaf17c37.0404200607.2dd83766@posting.google.c om...
    : Hi I'm querying a database and returning the records using absolute
    : page and all that stuff.
    :
    : The user can choose to do a keyword search or display all records.
    : the page is set up so that the sql statement gets passed back to the
    : page using the querystring method.
    :
    : This works great when the user selects the display all...i can browse
    : through the records perfect....however, when the user enters a keyword
    : I get the first page and when i click on next it displays no records
    : found....
    :
    : the whole sql string is getting passed thru...i did a response.write
    : to make sure and it seems intact...
    :
    : any help would be greatly appreciated.
    :
    : Thanx


    Ken Schaefer Guest

  5. #4

    Default Re: recordset paging won't show second page

    Sorry, here is the code

    ---Get parameters---
    iPageSize = cInt(perpage) '---perpage comes from the form, this works
    fine

    '--- set sql query ---
    if keyword<>"" then
    if category="boardname" then
    sql="select * from tblprofile where board_id in (select id from
    tblboards where " & category & " LIKE '%" & keyword & "%') and
    accountstatus='A'"
    else
    sql="select * from tblprofile where " & category & " LIKE '%" &
    keyword & "%' and accountstatus='A'"
    end if
    elseif request.form("displayall") = "on" or request.form("displayall") =
    "ON" then
    sql="select * from tblprofile where accountstatus='A'"
    else
    sql="select * from tblprofile where firstname LIKE '" & firstname & "'
    and accountstatus='A'"
    end if

    sql = sql & " order by " & sortby & " " & sortorder & ";"
    '-------------------------------------

    response.write sql 'just testing the value

    '--- Get variables from the url, if any ---
    if request.querystring("sql")<>"" then
    sql = trim(request.querystring("sql"))
    end if
    if request.QueryString("psize") <> "" then
    iPageSize = CInt(trim(Request.QueryString("psize")))
    end if

    ' ---Retrieve page to show or default to 1---
    If Request.QueryString("page") <> "" Then
    iPageCurrent = CInt(trim(Request.QueryString("page")))
    Else
    iPageCurrent = 1
    End If
    '--------------------------------------

    '---just testing the values to see what the hold---
    response.write "<br><br>" & sql & "<br>"
    response.write "page size " & iPageSize & "<br>"
    response.write "current page " & iPageCurrent & "<br>"

    ' ---connect to database ---
    Set objPagingConn = Server.CreateObject("ADODB.Connection")
    objPagingConn.Open CONN_STRING

    ' ---Create recordset and set the page size---
    Set rs= Server.CreateObject("ADODB.Recordset")
    rs.PageSize = iPageSize

    ' --- Indicates to the web server where the cursor for the current
    recordset should be created
    ' --- adUseClient creates cursor on client from ADOVBS.INC
    rs.CursorLocation = adUseClient
    rs.CacheSize = iPageSize

    ' ---Open RS---
    rs.Open sql, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText


    ' ---Get the count of the pages and records using the given page size---
    iPageCount = rs.PageCount
    iRecordCount = rs.RecordCount

    ' ---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

    '--again, just checking the value
    response.write "Page count " & iPageCount & "<br>"

    ' ---Check page count to prevent bombing when zero results are returned!
    If iPageCount = 0 Then
    Response.Write "No records found!"
    Else
    ' ---Move to the selected page
    rs.AbsolutePage = iPageCurrent

    '---Set numeric value of first and last record number being displayed
    iFRecord = rs.AbsolutePosition

    If CInt(iPageCurrent) = CInt(iPageCount) Then
    iLRecord = iRecordCount
    Else
    iLRecord = iFRecord + (rs.PageSize - 1)
    End if
    %>

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Supaya . Guest

  6. #5

    Default Re: recordset paging won't show second page


    hi ken, sorry bout that. I've posted the code!

    :) Tonya


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Supaya . Guest

  7. #6

    Default Re: recordset paging won't show second page

    "Supaya ." wrote
    > response.write sql 'just testing the value
    >
    > '--- Get variables from the url, if any ---
    > if request.querystring("sql")<>"" then
    > sql = trim(request.querystring("sql"))
    > end if
    Try this -

    '--- Get variables from the url, if any ---
    if request.querystring("sql")<>"" then
    sql = trim(request.querystring("sql"))
    end if

    response.write sql 'just testing the value


    --
    roger


    roger Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139