hi,
I'm a newb of ASP. I have an access database with two fields namely 'name' and 'comments'. And is working properly with add, delete, update, search etc.
But if the search output is gone beyond 10 items, then how is it possible to make appear the 11th item at the next page.
Hope some body can help me seriously...

Recommended Answers

All 4 Replies

That's pretty easy. You first use a Recordset, the you define the number of the records you want to be displayed per page, and you define the pageNumber you are in, and there you go. I would look like:

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("datanase.mdb")' & ";" ' Access

set TheConnection = Server.CreateObject("ADODB.Connection")

TheConnection.Open ConnectionString

Set RS = Server.CreateObject("ADODB.RECORDSET")
        
    RS.PageSize = 10 ' Or PageSize 
    RS.CacheSize = PageSize
    RS.CursorLocation = adUseClient
    
    RS.Open "SELECT * FROM TABLE Where CONDITION_ETC;",TheConnection,3,3

    CatEntries = RS_SHOW_ADS.RecordCount
    
    TotalPages = RS_SHOW_ADS.PageCount
    CurrentPage = CInt(Request("page"))
    RS.AbsolutePage = CurrentPage

Now you just need to show the data. When trying to switch between pages, remember to send along the CurrentPage-Variable. You can use the QueryString.

Good luck

hi,
I'm a newb of ASP. I have an access database with two fields namely 'name' and 'comments'. And is working properly with add, delete, update, search etc.
But if the search output is gone beyond 10 items, then how is it possible to make appear the 11th item at the next page.
Hope some body can help me seriously...

That's pretty easy. You first use a Recordset, the you define the number of the records you want to be displayed per page, and you define the pageNumber you are in, and there you go. I would look like:

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("datanase.mdb")' & ";" ' Access
 
set TheConnection = Server.CreateObject("ADODB.Connection")
 
TheConnection.Open ConnectionString
 
Set RS = Server.CreateObject("ADODB.RECORDSET")
 
    RS.PageSize = 10 ' Or PageSize 
    RS.CacheSize = PageSize
    RS.CursorLocation = adUseClient
 
    RS.Open "SELECT * FROM TABLE Where CONDITION_ETC;",TheConnection,3,3
 
    CatEntries = RS_SHOW_ADS.RecordCount
 
    TotalPages = RS_SHOW_ADS.PageCount
    CurrentPage = CInt(Request("page"))
    RS.AbsolutePage = CurrentPage

Now you just need to show the data. When trying to switch between pages, remember to send along the CurrentPage-Variable. You can use the QueryString.

Good luck

Sorry,
I don't know how to apply the above said codes. I'm herewith attaching my original guestbook code. Please reply with paging codes. Remember if the result is gone beyond 10 output, then i need paging with link to next page. i.e. <1><2> like this.Thanks in advance.
---------------------------------------------------------------------------------
<html>
<head>
<title>My First ASP Page</title>
</head>
<%
dim adocon
dim rsguestbook
dim strsql

set adocon=server.createobject("ADODB.connection")
adocon.open "driver={microsoft access driver (*.mdb)}; DBQ="& server.mappath("guestbook.mdb")
set rsguestbook=server.createobject("ADODB.recordset")
strSQL="Select * from tblcomments;"
rsguestbook.open strSQL, adocon

response.write "<tr>"
do while not rsguestbook.EOF
response.write("<br>")
response.write(rsguestbook("name"))
response.write("<br>")
response.write(rsguestbook("comments"))
response.write("<br>")
rsguestbook.movenext
loop

rsguestbook.close
set rsguestbook=nothing
set adocon=nothing
%>

<hr size="1" color="#FF00FF">
<br>
<% response.write formatdatetime(date, vblongdate) %><br>
<% response.write formatdatetime(time, vblongtime) %>
</body>
</html>

----------------------------------------------------------------------------
Reply as soon as possible
Anish
Delhi

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.