DB Paging not working

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

  1. #1

    Default DB Paging not working

    Whats wrong with my code? I have my AccessDB with 1000 records on tblItems.
    When I try to write the Pagecount on the screen, it writes "-1". Hope you
    might help.

    <%
    Set conn= Server.CreateObject("ADODB.Connection")
    conn.Open "FileDSN=file.dsn"

    strSQL = "SELECT * FROM tblItems ORDER BY Category "

    strPageSize= 20

    Set objPagingRS = Server.CreateObject("ADODB.Recordset")
    ObjPagingRS.PageSize = strPageSize
    ObjPagingRS.CacheSize = strPageSize
    ObjPagingRS.Open strSQL, conn

    strPageCount= ObjPagingRS.PageCount


    Response.Write "<BR>"
    Response.Write "Page Size is " & strPageSize
    Response.Write "<BR>"
    Response.Write "Page Count is " & strPageCount
    Response.Write "<BR>"
    Response.Write "Current Page is " & strPageCurrent
    Response.Write "<BR>"

    ..
    ..
    ..

    %>


    M P Guest

  2. Similar Questions and Discussions

    1. Macromedia Flash Player installed and working properly suddenlys stops working..
      No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving...
    2. DataGris Paging not working (event not firing)
      Hello, It seems that no matter what I do, I cannot get paging working on my datagrid. I'll try to explain as best as I can how my program...
    3. Why is my Paging not working in my DataGrid?
      Question: Why can't I enable paging in Datagrid? Answer: You must check 'AllowPaging' You must add code to handle the PageIndexChanged Event. ...
    4. Paging not working in a datagrid
      I'm trying to use paging in a datagrid, but I can't get past the "cannot compute Count for a data source that does not implement ICollection"...
    5. Dreamweaver MX Paging Not Working Correctly - HELP!
      Try using a search form with a METHOD of GET. Then you can request the querystring instead of the form variables. I'm not quite sure how you'd do...
  3. #2

    Default Re: DB Paging not working

    I wonder if an adOpenStatic (3) instead of the default adOpenForwardOnly
    (0) CursorType would help as is used here:

    Database Paging
    [url]http://www.asp101.com/samples/db_paging.asp[/url]
    Uses PageSize method of recordset.

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Designer
    [url]http://www.Bullschmidt.com[/url]
    ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


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

  4. #3

    Default Re: DB Paging not working

    [url]http://www.aspfaq.com/2120[/url] (paging methods)
    [url]http://www.aspfaq.com/2126[/url] (get rid of the DSN)
    [url]http://www.aspfaq.com/2096[/url] (don't use SELECT *)

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "M P" <mark@textguru.ph> wrote in message
    news:eWeHXbbWEHA.3472@TK2MSFTNGP09.phx.gbl...
    > Whats wrong with my code? I have my AccessDB with 1000 records on
    tblItems.
    > When I try to write the Pagecount on the screen, it writes "-1". Hope you
    > might help.
    >
    > <%
    > Set conn= Server.CreateObject("ADODB.Connection")
    > conn.Open "FileDSN=file.dsn"
    >
    > strSQL = "SELECT * FROM tblItems ORDER BY Category "
    >
    > strPageSize= 20
    >
    > Set objPagingRS = Server.CreateObject("ADODB.Recordset")
    > ObjPagingRS.PageSize = strPageSize
    > ObjPagingRS.CacheSize = strPageSize
    > ObjPagingRS.Open strSQL, conn
    >
    > strPageCount= ObjPagingRS.PageCount
    >
    >
    > Response.Write "<BR>"
    > Response.Write "Page Size is " & strPageSize
    > Response.Write "<BR>"
    > Response.Write "Page Count is " & strPageCount
    > Response.Write "<BR>"
    > Response.Write "Current Page is " & strPageCurrent
    > Response.Write "<BR>"
    >
    > .
    > .
    > .
    >
    > %>
    >
    >

    Aaron [SQL Server MVP] 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