Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > All Other Wrox Books
|
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 22nd, 2005, 12:12 AM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default profesional ASP 3.0 chapter 10 ADO paging

hi,
After i tried the sample code in chapter 10 ADO Paging.
It does not work as accordignly. In that page, table value does not change, still remand the first time record. It does not go to next page record. Is there any extra code ??? :((((

jose

  #2 (permalink)  
Old February 22nd, 2005, 12:34 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii josephine_aeiou
Have you used ?? rs.pagesize, currentpage and pagecount ???
Please can u provide the code?

Cheers :)

vinod
  #3 (permalink)  
Old February 22nd, 2005, 02:58 AM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,
please kindly let me know is very urgent
this is the code :((((

<%@ LANGUAGE=VBSCRIPT %>


<HTML>
<HEAD>
<TITLE>ASPPaging.asp</TITLE>
<STYLE TYPE="text/css">
BODY {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<SPAN CLASS="heading">Paging through Recordsets using ASP</SPAN>


<%
  Dim rsData
  Dim iPage
  Dim iTotalPages
  Dim fldF
  Dim iRec
  Dim sQuote
  Dim sMe

 const adOpenDynamic = 2
    const adOpenForwardOnly = 0
    const adOpenKeyset = 1
    const adOpenStatic = 3
    const adOpenUnspecified = -1

    const adLockBatchOptimistic = 4
    const adLockOptimistic = 3
    const adLockPessimistic = 2
    const adLockReadOnly = 1
    const adLockUnspecified = -1

    const adCmdFile = 256
    const adCmdStoredProc = 4
    const adCmdTable = 2
    const adCmdTableDirect = 512
    const adCmdText = 1
    const adCmdUnknown = 8
    const adCmdUnspecified = -1

    const adUseClient = 3

  sQuote = Chr(34) ' the double quote character

    MakeConnection conn
    conn.Open
  Set rsData = Server.CreateObject("ADODB.Recordset")

  ' set the page size
  rsData.PageSize = 10
  rsData.CursorLocation = adUseClient

  ' open the data
  rsData.Open "Tb_Asset", Conn, _
              adOpenForwardOnly, adLockReadOnly, adCmdTable

 ' get the requested data
  If Request.QueryString("PAGE") = "" Then
    iPage = 1
  Else
    ' protect against out of range pages, in case
    ' of a user specified page number
    If iPage < 1 Then
      iPage = 1
    Else
      If iPage > rsData.PageCount Then
        iPage = cint (rsData.PageCount)
      Else
        iPage = CInt(Request.QueryString("PAGE"))
      End If
    End If
  End If

  ' set the page
  rsData.AbsolutePage = iPage

  ' start building the table
  Response.Write ipage
  Response.Write "<TABLE BORDER=1><THEAD><TR>"
  For Each fldF In rsData.Fields
    Response.Write "<TD>" & fldF.Name & "</TD>"
  Next
  Response.Write "</TR></THEAD><TBODY>"

  ' now loop through the
  For iRec = 1 To rsData.PageSize
    If Not rsData.EOF Then
      Response.Write "<TR>"
      For Each fldF In rsData.Fields
        Response.Write "<TD>" & fldF.Value & "</TD>"
      Next
      Response.Write "</TR>"
      rsData.MoveNext
    End If
  Next
  Response.Write "</TBODY></THEAD></TABLE><P>"

  ' now some paging controls
  sMe = Request.ServerVariables("SCRIPT_NAME")
  Response.Write "&nbsp;<A HREF=" & sQuote & sMe & "?PAGE=1" & sQuote & ">First Page</A>"

  ' only give an active previous page if there are previous pages
  If iPage = 1 Then
    Response.Write "&nbsp;<SPAN>Previous Page</SPAN>"
  Else
    Response.Write "&nbsp;<A HREF=" & sQuote & sMe & "?PAGE=" & iPage - 1 & sQuote & ">Previous Page</A>"
  End If

  ' only give an active next page if there are more pages
  If iPage = rsData.PageCount Then
    Response.Write "&nbsp;<SPAN>Next Page</SPAN>"
  Else
    iPage= cint (iPage) + 1
    Response.Write "&nbsp;<A HREF=" & sMe &"?PAGE=" & iPage & ">Next Page</A>"
  End If

  Response.Write "&nbsp;<A HREF=" & sMe & "?PAGE=" & rsData.PageCount & ">Last Page</A>"
  ' and clear up
  rsData.Close
  Set rsData = Nothing
%>


<SPAN CLASS="cite">&copy;1999 <A CLASS="cite" HREF="http://www.wrox.com/">Wrox Press</A> -
<A CLASS="cite" HREF="http://webdev.wrox.co.uk/books/2610/">Professional ASP 3.0</A> (ISBN: 1-861002-61-0)</SPAN>
</BODY>
</HTML>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 1-GridView Paging Carl Tseng BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 November 25th, 2007 06:56 AM
ADO Paging - ASP returns wrong PageCoun spencer Classic ASP Databases 1 July 29th, 2004 06:15 AM
Paging in ADO.NET tknguyen ADO.NET 2 June 24th, 2003 09:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.