473,463 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2295
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: 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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.