DB Paging not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M P

    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.CreateOb ject("ADODB.Con nection")
    conn.Open "FileDSN=file.d sn"

    strSQL = "SELECT * FROM tblItems ORDER BY Category "

    strPageSize= 20

    Set objPagingRS = Server.CreateOb ject("ADODB.Rec ordset")
    ObjPagingRS.Pag eSize = strPageSize
    ObjPagingRS.Cac heSize = strPageSize
    ObjPagingRS.Ope n strSQL, conn

    strPageCount= ObjPagingRS.Pag eCount


    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]

    #2
    Re: DB Paging not working

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

    --
    Please contact this domain's administrator as their DNS Made Easy services have expired.

    (Reverse address to reply.)




    "M P" <mark@textguru. ph> wrote in message
    news:eWeHXbbWEH A.3472@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Whats wrong with my code? I have my AccessDB with 1000 records on[/color]
    tblItems.[color=blue]
    > When I try to write the Pagecount on the screen, it writes "-1". Hope you
    > might help.
    >
    > <%
    > Set conn= Server.CreateOb ject("ADODB.Con nection")
    > conn.Open "FileDSN=file.d sn"
    >
    > strSQL = "SELECT * FROM tblItems ORDER BY Category "
    >
    > strPageSize= 20
    >
    > Set objPagingRS = Server.CreateOb ject("ADODB.Rec ordset")
    > ObjPagingRS.Pag eSize = strPageSize
    > ObjPagingRS.Cac heSize = strPageSize
    > ObjPagingRS.Ope n strSQL, conn
    >
    > strPageCount= ObjPagingRS.Pag eCount
    >
    >
    > 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>"
    >
    > .
    > .
    > .
    >
    > %>
    >
    >[/color]


    Comment

    Working...