If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > eliminat the 10 records per page. Make full in page.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-04, 00:03
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
eliminat the 10 records per page. Make full in page.

How do you take away the 10 records/page? I'm getting 10 records instead of getting the full 31 records.

Code:
<%
'Option Explicit
'Response.End 
Response.Buffer=false

'************************************************************************************
'* Declaration section
'************************************************************************************
' Mode contstants
Const MODE_DEFAULT  = 1
Const MODE_RESULTS  = 2

Const DB_NAME           = "kjv.mdb"
Const SCRIPT_NAME       = "kjv.asp"
Const SCRIPT_TEXTS      = "kjvresp.asp"
Const SCRIPT_SAVED      = "saved.asp"
Const SCRIPT_FEEDBACK   = "mailto.asp"
Const SCRIPT_TEXT       = "bibletext1.asp"
Const SCRIPT_READ       = "bibletextresp1.asp"

Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = &H0200
Const adUseClient = 3

Dim nMode   ' Current Mode
'************************************************************************************
'* End of Declaration section
'************************************************************************************

'************************************************************************************
'* Main section
'************************************************************************************

' Find out what mode we are in
nMode = CLng(Request.QueryString("Mode"))

' Depending on our mode we will do different things
Select Case nMode
    
    Case MODE_RESULTS
        ' This is where all the results will show       
        call ShowResults()

    Case Else   ' This one is for MODE_DEFAULT or invalid modes all the same
        ' By default display the search form
        call ShowSearchForm()
End Select

'************************************************************************************
'* End of Main section
'************************************************************************************

'**************************************************************************************
'* Functions section
'**************************************************************************************


' This function will generate our connection string
' it assumes that Access database is in the same folder as this script

Private Function GetConnectionString()
    GetConnectionString =   "Driver={Microsoft Access Driver (*.mdb)};" & _
                "DBQ=" & Server.MapPath(DB_NAME) & ";" & _
                "UID=;PWD=;"
End Function

' Shows HTML page header 
Public Sub OutputPageHeader()
    %>
    <HTML>
    <HEAD><TITLE>Result Page</TITLE>
</HEAD>
<BODY>

    <%
End Sub

' Shows HTML page footer 
Public Sub OutputPageFooter()
    %>
</BODY>
</HTML>
    <%
End Sub

' This function will display the search form
Private Sub ShowSearchForm()
    call OutputPageHeader()
    %>
    <!--
        This form will direct user to itself with MODE_RESULTS mode
    -->
    <%
' This function will display the results of the search
 call ShowResults()
End Sub


Sub ShowResults()
Dim strConn     ' Database connection string
    Dim SQL         ' String that will have our SQL statments
    Dim RS          ' Recordset object
    Dim Keyword     ' Keyword for search
    Dim Keywordd     ' Keyword for search
    Dim Keyworde     ' Keyword for search
    Dim Keywordf     ' Keyword for search
'pageing
    Dim nRecCount   ' Number of records found

    Dim nPage       ' Current page number
'query
    Dim iCounter
    Dim iLoopCount
    Dim aRecTypes
    Dim spoke       ' For dropdown
    Dim number
    Dim Keywordb
    Dim Keywordc

    'Dim book       ' For dropdown
    Dim numberb
    Dim intRec


    ' Let's see what page are we looking at right now
    nPage = CLng(Request.QueryString("Page"))

    ' Let's see what user wants to search for today :)
    Keyword = Trim(Request.QueryString("Keyword"))
    book = Request.Querystring("book")

number = Request.QueryString("number")
Keywordb = Request.QueryString("Keywordb")
Keywordc = Request.QueryString("Keywordc")
Keywordd = Request.QueryString("Keywordd")
Keyworde = Request.QueryString("Keyworde")
Keywordf = Request.QueryString("Keywordf")


    SQL = "SELECT * FROM bible WHERE "
    strConn = GetConnectionString()



'Set conn = Server.CreateObject("ADODB.Connection")  
'conn.Open(GetConnectionString)              



iCounter = 0

If   request.QueryString("text_data")=yes then

  SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "
  iCounter = iCounter + 1
End If

If   request.QueryString("chapter")=yes then
  SQL = SQL & "chapter LIKE '" & number & "'"

End If

'If   request.QueryString("verse")=yes then
'  SQL = SQL & "verse LIKE '" & numberb & "'"

'End If



If Trim(Request.QueryString("recordType")) <> "" Then


  aRecTypes = Split(Request.QueryString("recordType"), ",")

  If IsArray(aRecTypes) Then 'This is a bit redundant, but it can't hurt
    SQL = SQL & " AND ("

    For iLoopCount = 0 To UBound(aRecTypes)
      If iLoopCount <> 0 Then
        SQL = SQL & " AND "
      End If

      SQL = SQL & " recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
    Next
  End If
  SQL = SQL & ")"
End If

' Time to create and open recordset
    Set RS = Server.CreateObject("ADODB.Recordset")

'dim pages


rs.CursorLocation = adUseClient
rs.CacheSize = 20
    RS.Open SQL, strConn, adOpenForwardOnly, adLockReadOnly
rscount=rs.RecordCount


if request.querystring("page")="" then 
   page=1
else
   page=cint((request.querystring("page")))
end if
        Response.Write rscount & " verses.<br>"

     Response.Write "</div>" & vbcrlf
%>

<%If rs.BOF and rs.EOF Then%>
<H2 align="center">We did not find a match of <i><b>"<%=Keyword%>&nbsp;<%=Keywordb%>&nbsp;<%=Keywordc%>&nbsp;<%=Keywordd%>&nbsp;<%=Keyworde%>&nbsp;<%=Keywordf%>"</b></i>!</H2>
<H4><A HREF="<%=SCRIPT_NAME%>">Back Home</A></H4>

<%Else%>
<%
If Not rs.EOF Then
Response.Write "There are " & rs.RecordCount & " records found matching ""<font color='red'><b>" & Keyword & "</b></font>"" ""<font color='blue'><b>" & Keywordb & "</b></font>"" ""<font color='green'><b>" & Keywordc & "</b></font>"" ""<font color='orange'><b>" & Keywordd & "</b></font>"" ""<font color='purple'><b>" & Keyworde & "</b></font>"" ""<font color='aqua'><b>" & Keywordf & "</b></font>"".<br>""" 
'Response.Write "There are " & rs.PageCount & " page(s) of result(s).<br>"
'Response.Write "The current page is " & rs.AbsolutePage & ".<p>"
End if%>

<span style="font-size:8pt;font-family:Verdana"><b><%=RS("book_title")%>&nbsp;&nbsp; 
<%=rs("chap")%>:</b><br>
<%
if not rs.eof then
rs.Move (page-1)*rs.pagesize
end if
if not rs.eof then
     ' Display the records
for i=1 to rs.pagesize%>

<br><b><%=rs("vers")%></b>&nbsp;&nbsp;<%=text_data%></span>
<!--#include file=highlight3.asp-->

   <%rs.movenext
      ' Exit the loop when reaching the end of the recordset
If rs.EOF Then Exit For end if
next
end if%>


<%
rs.Close

    ' Finish this page
    Call OutputPageFooter()
End if
End Sub
%>
Reply With Quote
  #2 (permalink)  
Old 12-27-04, 15:32
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
The code you have posted uses the rs.PageSize property to create the ability to page through data. rs.PageSize defaults to 10, which I think is why you are getting 10 records per page. To increase this, just set rs.PageSize equal to whatever you want just after opening the recordset.

rs.PageSize = 50

Tim
__________________
Tim
Reply With Quote
  #3 (permalink)  
Old 12-29-04, 18:38
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Or of course perhaps:

rs.PageSize = 1000000
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On