473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Separate Pagewise

I am using ASP and Ms Access. To view the details from table. I have added more than 25 records. so i want to separate the pagewise. First page i want display the 10 record. Next page next 10. plz help me for this coding.
Feb 27 '08 #1
1 2294
CroCrew
564 Expert 512MB
Hello silvia21,

Here is an example that you can use. Let me know if you need a copy of an example database that this will work with. The page is called Example.asp

Hope this helps~

Example.asp
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     NumberOfRecordsPerPage = 3
  3.  
  4.     Function GetPageNumber()
  5.         Select Case Request("xAction")
  6.             Case "Beginning"
  7.                 GetPageNumber = 1
  8.             Case "Previous"
  9.                 GetPageNumber = Request("intpage") - 1
  10.                 If (GetPageNumber < 1) Then 
  11.                     GetPageNumber = 1
  12.                 End If
  13.             Case "Next"
  14.                 GetPageNumber = Request("intpage") + 1
  15.                 If (GetPageNumber > intPageCount) Then
  16.                     GetPageNumber = IntPageCount
  17.                 End If
  18.             Case "Last"
  19.                 GetPageNumber = intPageCount
  20.             Case Else
  21.                 GetPageNumber = 1
  22.         End Select 
  23.     End Function
  24.  
  25.     SQL = "SELECT FieldOne, FieldTwo, FieldThree FROM TheTable"
  26.  
  27.     Set Conn = Server.CreateObject("ADODB.Connection")
  28.         Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Database/Database.mdb") 
  29.         Set rsList = Server.CreateObject("ADODB.Recordset")
  30.             rsList.CursorType = 1
  31.             rsList.LockType = 3
  32.             rsList.Open SQL, Conn
  33.             rsList.PageSize = NumberOfRecordsPerPage 
  34.  
  35.         intPageCount = rsList.PageCount
  36.         intpage = GetPageNumber()
  37.         rsList.AbsolutePage = intPage
  38. %>
  39. <html>
  40.     <head>
  41.         <title>Example</title>
  42.         <script language="JavaScript">
  43.             function MoveTopage(xAction)
  44.             {
  45.                 document.PageMove.xAction.value=xAction;
  46.                 document.PageMove.submit();
  47.             }
  48.         </script >
  49.     </head>
  50.     <body>
  51.         <table width="600">
  52.             <tr>
  53.                 <td>
  54.                     <table width="100%">
  55.                         <tr>
  56.                             <td>Field One</td>
  57.                             <td>Field Two</td>
  58.                             <td>Field Three</td>
  59.                         </tr>
  60.                         <%For intRecord = 1 To rsList.PageSize%>
  61.                             <tr>
  62.                                 <td><%=rsList("FieldOne").value%></td>
  63.                                 <td><%=rsList("FieldTwo").value%></td>
  64.                                 <td><%=rsList("FieldThree").value%></td>
  65.                             </tr>
  66.                             <%response.flush%>
  67.                             <%rsList.MoveNext%>
  68.                             <%If rsList.EOF Then Exit For%>
  69.                         <%Next%>
  70.                     </table>
  71.                 </td>
  72.             </tr>
  73.             <tr>
  74.                 <td align="center">
  75.                     <input type="button" value=" &lt;&lt; " onclick="MoveTopage('Beginning');">
  76.                     <input type="button" value=" &lt; " onclick="MoveTopage('Previous');">
  77.                     <input type="button" value=" &gt; " onclick="MoveTopage('Next');">
  78.                     <input type="button" value=" &gt;&gt; " onclick="MoveTopage('Last');">
  79.                     <br>Page: <%=Intpage & " of " & intpagecount%>
  80.                 </td>
  81.             </tr>
  82.         </table>
  83.         <form name="PageMove" action="Example.asp" method="post">
  84.             <input type="hidden" name="xAction" value="">
  85.             <input type="hidden" name="intpage" value="<%=intpage%>">
  86.         </form>
  87.     </body>
  88. </html>
  89.  
  90.  
  91.  
  92.  
Feb 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Roberto Becerril | last post by:
Hi forum, i'm a little new in javascript and maybe you can help me. I have an html form and an icon, if i click on the icon, a new pop-up window is open and shows a list of numbers with a...
2
by: Mike Hennessy | last post by:
I'm looking for people's opinions and feedback regarding the design of the application tier, and how to best logically separate out the Data Access from the Business Object's. Per the Microsoft...
0
by: krzychu | last post by:
Hallo, I have an existing plone site called "info", I've added some scripts to it. I would like to have that plone site into a separate ZODB database(separate ..fs file). There is a MountFolder...
4
by: Scott Kinney | last post by:
I have an inventory database. I want to delete out-of-stock items from the main database, but keep them in a separate table so that I can reference data about them. I created a copy of the item...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
3
by: LurfysMa | last post by:
I would like to hear opinions on the tradeoffs of putting the tables, forms, and queries for several related datasets in separate databases vs one combined database. I am working on an...
6
by: Neelesh2007 | last post by:
Hi all. In my project I am using VB6.0 & Access 2003. I want to create Slab wise & Pagewise Datareport as shown below. Marks <30 ID Subject Marks 11 Maths 25 75 ...
1
by: Silgd1 | last post by:
Hi All..... I am using netbeans 6.1 to create a web application(visual web jsf pages). I have a heavy task I need to run, so I run the task in a separate thread which is started from a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.