Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2004
    Posts
    494

    Unanswered: adding counts to search results

    I found this on the net but it shows that he is using one ASP page for both search and response. I need it for two pages. The first for HTML coding and the second (response page) with ASP coding. What do I need to modify?

    Code:
    <%
    ' Declare our variables... always good practice!
    Dim strURL     ' The URL of this page so the form will work
                   ' no matter what this file is named.
    
    Dim cnnSearch  ' ADO connection
    Dim rstSearch  ' ADO recordset
    Dim strDBPath  ' path to our Access database (*.mdb) file
    
    Dim strSQL     ' The SQL Query we build on the fly
    Dim strSearch  ' The text being looked for
    
    ' Retreive the URL of this page from Server Variables
    strURL = Request.ServerVariables("URL")
    
    ' Retreive the term being searched for.  I'm doing it on
    ' the QS since that allows people to bookmark results.
    ' You could just as easily have used the form collection.
    strSearch = Request.QueryString("search")
    'strSearch = Replace(strSearch, "'", "''")
    
    ' Since I'm doing this all in one page I need to see if anyone
    ' has searched for something.  If they have we hit the DB.
    ' O/W I just show the search form and quit.
    
    %>
    <p>Search our sample db by first or last name.  (% returns all)</p>
    <form action="<%= strURL %>" method="get">
    <input name="search" value="<%= strSearch %>" />
    <input type="submit" />
    </form>
    <p>[Try 'am' or 'er' for an example]</p>
    <%
    If strSearch <> "" Then
    	' MapPath of virtual database file path to a physical path.
    	' If you want you could hard code a physical path here.
    	strDBPath = Server.MapPath("database.mdb")
    
    
    	' Create an ADO Connection to connect to the sample database.
    	' We're using OLE DB but you could just as easily use ODBC or a DSN.
    	Set cnnSearch = Server.CreateObject("ADODB.Connection")
    
    	' This line is for the Access sample database:
    	'cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
    
    	' We're actually using SQL Server so we use this line instead:
    	cnnSearch.Open "Provider=SQLOLEDB;Data Source=10.2.1.214;" _
    		& "Initial Catalog=samples;User Id=samples;Password=password;" _
    		& "Connect Timeout=15;Network Library=dbmssocn;"
    
    	' Build our query based on the input.
    	strSQL = "SELECT last_name, first_name, sales " _
    		& "FROM sample " _
    		& "WHERE last_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    		& "OR first_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    		& "ORDER BY last_name;"
    
    	' Execute our query using the connection object.  It automatically
    	' creates and returns a recordset which we store in our variable.
    	Set rstSearch = cnnSearch.Execute(strSQL)
    
    	' Display a table of the data in the recordset.  We loop through the
    	' recordset displaying the fields from the table and using MoveNext
    	' to increment to the next record.  We stop when we reach EOF.
    	' For fun I'm combining some fields and showwing you can do more then
    	' just spit out the data in the form it is in in the table.
    	%>
    	<table border="1">
    	<tr>
    	<th>Name</th>
    	<th>Sales</th>
    	</tr>
    	<%
    	Do While Not rstSearch.EOF
    		%>
    		<tr>
    		<td><%= rstSearch.Fields("first_name").Value %> <%= rstSearch.Fields("last_name").Value %></td>
    		<td><%= rstSearch.Fields("sales").Value %></td>
    		</tr>
    		<%
    
    		rstSearch.MoveNext
    	Loop
    	%>
    	</table>
    	<%
    	' Close our recordset and connection and dispose of the objects
    	rstSearch.Close
    	Set rstSearch = Nothing
    	cnnSearch.Close
    	Set cnnSearch = Nothing
    End If
    
    ' That's all folks!  See it's really not all that hard.
    %>

  2. #2
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Perhaps start by changing this:

    strURL = Request.ServerVariables("URL")

    To be more like this instead:

    strURL = "myresponsepage.asp"
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Jul 2004
    Posts
    494

    Oh- I've changed that. Here is the new code but there's error at bottom of page

    Code:
    <%
    Option Explicit
    
    '************************************************************************************
    '* Declaration section
    '************************************************************************************
    ' Mode contstants
    Const MODE_DEFAULT 	= 1
    Const MODE_RESULTS 	= 2
    
    Const DB_NAME		= "kjv.mdb"	' Name of our database file
    Const SCRIPT_NAME	= "bible5.asp"	' Name of this script
    
    Const RECORDS_PER_PAGE 	= 20			' Number of records per page
    
    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		
    		ShowResults
    
    	Case Else 	' This one is for MODE_DEFAULT or invalid modes all the same
    		' By default display the search form
    		ShowSearchForm	
    End Select
    
    '************************************************************************************
    '* End of Main section
    '************************************************************************************
    
    '************************************************************************************
    '* Functions section
    '************************************************************************************
    
    Private Function GetConnectionString()
    	GetConnectionString = 	"Driver={Microsoft Access Driver (*.mdb)};" & _
    				"DBQ=" & Server.MapPath(DB_NAME) & ";" & _
    				"UID=;PWD=;"
    End Function
    
    
    Public Function OutputPageHeader()
    	%>
    	<HTML>
    	<HEAD><TITLE>ADO Recordset Paging Sample</TITLE></HEAD>
    	<BODY>
    	<H2>Search the bible, the Wheel of God</H2>
    	<H3><A HREF="<%=SCRIPT_NAME%>">Back Home</A></H3>
    	<%
    End Function
    
     
    Public Function OutputPageFooter()
    	%>
    	</BODY>
    	</HTML>
    	<%
    End Function
    
    
    Private Function ShowSearchForm()
    	OutputPageHeader
    	%>
    	<!--
    		This form will direct user to itself with MODE_RESULTS mode
    	-->
    	<FORM ACTION="<%=SCRIPT_NAME%>" METHOD="GET">
    	Look for: <INPUT TYPE="text" NAME="Keyword" VALUE=""> <INPUT TYPE="submit" VALUE=" Search "><input type="reset">
    <INPUT TYPE="hidden" NAME="Mode" VALUE="<%=MODE_RESULTS%>"><p>
    If you search number write 001 instead of 1 and 022 instead of 22
    	
    </td>
    <br>
    <INPUT TYPE="CheckBox" NAME="book" VALUE="Book">Book<br>
        <INPUT TYPE="CheckBox" NAME="book_spoke" VALUE="Book Spoke">Book Spoke<br>
        <INPUT TYPE="CheckBox" NAME="book_title" VALUE="Book Title">Book Title<br>
        <INPUT TYPE="CheckBox" NAME="chapter" VALUE="Chapter">Chapter<br>
        <INPUT TYPE="CheckBox" NAME="chapter_spoke" VALUE="Chapter Spoke">Chapter Spoke<br>
        <INPUT TYPE="CheckBox" NAME="verse" VALUE="Verse">Verse<br>
        <INPUT TYPE="CheckBox" NAME="verse_spoke" VALUE="Verse Spoke">Verse Spoke<br>
        <INPUT TYPE="CheckBox" NAME="text_data" VALUE="Text" CHECKED>Text<br>
     </tr>
    	</FORM>
    	<%
    	OutputPageFooter
    End Function
    
    ' This function will display the results of the search
    Private Function 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 nRecCount	' Number of records found
    	Dim nPageCount	' Number of pages of records we have
    	Dim nPage	' Current page number
    	Dim iCounter	'for the checkboxes
    
    	' 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"))
    
    	' define our SQL statment
    	' we will be looking for all the records in tblItem table 
    	' where ItemName contains our Keyword
    	' do not forget to fix tick marks (single quotes) in our Keyword
    	SQL = "SELECT * FROM bible WHERE "
    	' Create our connection string
    	strConn = GetConnectionString()
    
    If   request.QueryString("book")="yes" then
    
      Sql = Sql & "book LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("book_spoke")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "book_spoke LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("book_title")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "book_title LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("chapter")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "chapter LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    
    If   request.QueryString("chapter_spoke")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "chapter_spoke LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("verse")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "verse LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("verse_spoke")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "verse_spoke LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("text_data")="yes" then
    
      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If
    
      Sql = Sql & "text_data LIKE '%" & Keyword & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    	' Time to create and open recordset
    	Set RS = Server.CreateObject("ADODB.Recordset")
    	RS.CursorLocation = 3 ' adUseClient
    	RS.Open SQL, strConn ' adOpenKeyset CursorType
    
    	' Start outputing HTML
    	OutputPageHeader
    
    	' Did we find anything?
    	If Not RS.Eof Then
    		' Let's deal with our findings
    		
    		' Get records count
    		nRecCount = RS.RecordCount
    
    		' Tell recordset to split records in the pages of our size
    		RS.PageSize = RECORDS_PER_PAGE
    
    		' How many pages we've got
    		nPageCount = RS.PageCount
    
    		' Make sure that the Page parameter passed to us is within the range
    		If nPage < 1 Or nPage > nPageCount Then
    			' Ops - bad page number
    			' let's fix it
    			nPage = 1			
    		End If
    
    		' Time to tell user what we've got so far
    		Response.Write nRecCount & " records found matching """ & Keyword & """.<br>"
    		Response.Write nPageCount & " pages of results.<br>"
    		Response.Write "Current page is " & nPage & ".<p>"
    		
    		' Give user some navigation
    
    		' first page
    		' we link to this page with Page parameter = 1
    		Response.Write 	"<A HREF=""" & SCRIPT_NAME & _
    				"?Keyword=" & Keyword & _
    				"&Mode=" & MODE_RESULTS & _
    				"&Page=" & 1 & _
    				""">First Page</A>"
    		Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;"
    
    		' Previous Page
    		' we link to this page with Page parameter = Current Page - 1
    		Response.Write 	"<A HREF=""" & SCRIPT_NAME & _
    				"?Keyword=" & Keyword & _
    				"&Mode=" & MODE_RESULTS & _
    				"&Page=" & nPage - 1 & _
    				""">Prev. Page</A>"
    		Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;"
    	
    		' Next Page
    		' we link to this page with Page parameter Current Page + 1
    		Response.Write 	"<A HREF=""" & SCRIPT_NAME & _
    				"?Keyword=" & Keyword & _
    				"&Mode=" & MODE_RESULTS & _
    				"&Page=" & nPage + 1 & _
    				""">Next Page</A>"
    		Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;"
    
    		' Last Page
    		' we link to this page with Page parameter = nPageCount
    		Response.Write 	"<A HREF=""" & SCRIPT_NAME & _
    				"?Keyword=" & Keyword & _
    				"&Mode=" & MODE_RESULTS & _
    				"&Page=" & nPageCount & _
    				""">Last Page</A>"
    
    		' Start Results
    		Response.Write "<p><b>These are the results:</b><br>" & String(20,"-")
    
    		' Position recordset to the page we want to see
    		RS.AbsolutePage = nPage
    
    		' Let's output our records				
    		' Loop through records until it's a next page or End of Records
    
    %>
    <table BORDER="0" width="100%" cellpadding="3">
      <tr>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Book </font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Book Spoke </font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Book Title </font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Chapter </font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Chapter Spoke</font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Verse </font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Verse Spoke</font></th>
    	<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Text </font></th>
      </tr>
    <%
    		Do While Not (RS.Eof OR RS.AbsolutePage <> nPage)
    			
    
    
    %> '324
      <tr>
        	<td><%=rs("book")%>&#32
    </td>
    	<td><%=rs("book_spoke")%>
    </td>
        	<td><%=rs("book_title")%>
    </td>
        	<td><%=rs("chapter")%>
    </td>
      	<td><%=rs("chapter_spoke")%>
    </td>
        	<td><%=rs("verse")%>
    </td>
        	<td><%=rs("verse_spoke")%>
    </td>
        	<td><%=rs("text_data")%>
    </td>
      </tr>
    
    
    
    
    			' Move on to the next record
    			RS.MoveNext
    		Loop
    	Else
    		' We did not find anything
    		Response.Write "Nothing found. Try again.<p><A HREF=""" & SCRIPT_NAME & """>Back</A>"
    	End If
    
    </table>
    <%End If%>
    <%End If%>
    
    	' Be nice - close the recordset
    	RS.Close
    	
    	' Finish this page
    	OutputPageFooter
    End Function
    '************************************************************************************
    '* End of Functions section
    '************************************************************************************
    %>
    Microsoft VBScript compilation error '800a0400'

    Expected statement

    /bible5.asp, line 355

    End If
    ^

  4. #4
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    <<
    /bible5.asp, line 355
    >>

    I'd suggest correcting the code on line 355:

    OutputPageFooter

    Perhaps make it more like this instead:

    Call OutputPageFooter()
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  5. #5
    Join Date
    Jul 2004
    Posts
    494

    that didn't correct line 355

    didn't work.

  6. #6
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Perhaps get rid of those extra End If's at the end:
    <%End If%>
    <%End If%>
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  7. #7
    Join Date
    Jul 2004
    Posts
    494

    this is what it says

    Microsoft VBScript compilation error '800a0400'

    Expected statement

    /bible5.asp, line 51

    end select
    ^
    Code:
    <%
    Option Explicit
    '*************************************************  ********
    '* Declaration section
    '*************************************************  ********
    ' Mode contstants
    Const MODE_DEFAULT 	= 1
    Const MODE_RESULTS 	= 2
    
    Const DB_NAME		= "kjv.mdb"	' Name of our database file
    Const SCRIPT_NAME	= "bible5.asp"	' Name of this script
    
    Const RECORDS_PER_PAGE 	= 20			' Number of records per page
    
    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		
    		ShowResults
    
    	Case Else 	' This one is for MODE_DEFAULT or invalid modes all the same
    		' By default display the search form
    		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

  8. #8
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Perhaps check all your code (especially in ShowResults and ShowSearchForm) to be sure that everytime you have an If that you also have an End If and that your Select statements look good...
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  9. #9
    Join Date
    Jul 2004
    Posts
    494

    Paging problems. ShowResult()... Private sub? Call? Public?

    The checkboxes and every thing are working. Now the paging is an issue because the code that I started and the code within paging seem quite different.

    One had

    Set dbGlobalWeb = Server.CreateObject("ADODB.Connection")

    the other

    Set RS = Server.CreateObject("ADODB.Recordset")

    What's the difference?

    Anyways the error shows this:

    Microsoft VBScript compilation error '800a03ea'

    Syntax error

    /amos13.asp, line 88

    Call Private Sub ShowResults()
    The code is:

    Code:
    <% 
    ' This function will display the results of the search 
    Private Sub ShowResults() 
        Dim strConn     ' Database connection string 
        Dim SQL         ' String that will have our SQL statments 
        Dim RSGlobalWeb ' Recordset object 
        Dim Keyword     ' Keyword for search 
        Dim nRecCount   ' Number of records found 
        Dim nPageCount  ' Number of pages of records we have 
        Dim nPage       ' Current page number 
        Dim iCounter 
        Dim iLoopCount 
        Dim aRecTypes 
        Dim spoke       ' For dropdown 
    
        ' 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")) 
        spoke = Request.Querystring("spoke") 
    
        ' define our SQL statement 
        ' we will be looking for all the records in tblItem table 
        ' where ItemName contains our Keyword 
        ' do not forget to fix tick marks (single quotes) in our Keyword 
        SQL = "SELECT * FROM bible WHERE " 
        strConn = GetConnectionString() 
    
    
    
    'Set dbGlobalWeb = Server.CreateObject("ADODB.Connection")  
    'dbGlobalWeb.Open(GetConnectionString)   taken out because I though it would be irrelevant  
    
    
    iCounter = 0 
    
    If   request.QueryString("book")="yes" then 
    
      SQL = SQL & "book LIKE '%" & Keyword & "%'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    
    If   request.QueryString("book_title")="yes" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " OR " 
      End If 
    
      SQL = SQL & "book_title LIKE '%" & Keyword & "%'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    If   request.QueryString("chapter")="yes" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " OR " 
      End If 
    
      SQL = SQL & "chapter LIKE '%" & Keyword & "%'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    If   request.QueryString("verse")="yes" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " OR " 
      End If 
    
      SQL = SQL & "verse LIKE '%" & Keyword & "%'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    
    If   request.QueryString("text_data")="yes" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " OR " 
      End If 
    
      SQL = SQL & "text_data LIKE '%" & Keyword & "%'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    
    If   request.QueryString("book_spoke")="Book_Spoke" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " AND " 
      End If 
    
      SQL = SQL & "book_spoke = '" & spoke & "'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    If   request.QueryString("chapter_spoke")="Chapter_Spoke" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " AND " 
      End If 
    
      SQL = SQL & "chapter_spoke = '" & spoke & "'" 
    
      iCounter = iCounter + 1 
    
    end if 
    
    If   request.QueryString("verse_spoke")="Verse_Spoke" then 
    
      If iCounter > 0 Then 
        SQL = SQL & " AND " 
      End If 
    
      SQL = SQL & "verse_spoke = '" & spoke & "'" 
    
      iCounter = iCounter + 1 
    
    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 & " OR " 
          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") 
        RS.CursorLocation = 3 ' adUseClient 
        Response.Write sql 
        RS.Open SQL, strConn ' adOpenKeyset CursorType 
    
        ' Start outputing HTML 
        call OutputPageHeader() 
    
        ' Did we find anything? 
        If Not RS.Eof Then 
            ' Let's deal with our findings 
            
            ' Get records count 
            nRecCount = RS.RecordCount 
    
            ' Tell recordset to split records in the pages of our size 
            RS.PageSize = RECORDS_PER_PAGE 
    
            ' How many pages we've got 
            nPageCount = RS.PageCount 
    
            ' Make sure that the Page parameter passed to us is within the range 
            If nPage < 1 Or nPage > nPageCount Then 
                ' Ops - bad page number 
                ' let's fix it 
                nPage = 1            
            End If 
    
            ' Time to tell user what we've got so far 
            Response.Write nRecCount & " records found matching """ & Keyword & """.<br>" 
            Response.Write nPageCount & " pages of results.<br>" 
            Response.Write "Current page is " & nPage & ".<p>" 
            
            ' Give user some navigation 
    
            ' first page 
            ' we link to this page with Page parameter = 1 
            Response.Write  "<A HREF=""" & SCRIPT_NAME & _ 
                    "?Keyword=" & Keyword & _ 
                    "&Mode=" & MODE_RESULTS & _ 
                    "&Page=" & 1 & _ 
                    """>First Page</A>" 
            Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;" 
    
            ' Previous Page 
            ' we link to this page with Page parameter = Current Page - 1 
            Response.Write  "<A HREF=""" & SCRIPT_NAME & _ 
                    "?Keyword=" & Keyword & _ 
                    "&Mode=" & MODE_RESULTS & _ 
                    "&Page=" & nPage - 1 & _ 
                    """>Prev. Page</A>" 
            Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;" 
        
            ' Next Page 
            ' we link to this page with Page parameter Current Page + 1 
            Response.Write  "<A HREF=""" & SCRIPT_NAME & _ 
                    "?Keyword=" & Keyword & _ 
                    "&Mode=" & MODE_RESULTS & _ 
                    "&Page=" & nPage + 1 & _ 
                    """>Next Page</A>" 
            Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;" 
    
            ' Last Page 
            ' we link to this page with Page parameter = nPageCount 
            Response.Write  "<A HREF=""" & SCRIPT_NAME & _ 
                    "?Keyword=" & Keyword & _ 
                    "&Mode=" & MODE_RESULTS & _ 
                    "&Page=" & nPageCount & _ 
                    """>Last Page</A>" 
    
            ' Start Results 
            Response.Write "<p><b>These are the results:</b><br>" & String(50,"-") 
    
            ' Position recordset to the page we want to see 
            RS.AbsolutePage = nPage 
    
            ' Let's output our records              
            ' Loop through records until it's a next page or End of Records 
    
    %>
    .....End Sub at the end

  10. #10
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Is that all of the code on the page amos13.asp? Line 88 doesn't show anything of concern.
    That which does not kill me postpones the inevitable.

  11. #11
    Join Date
    Jul 2004
    Posts
    494

    here is the entire code

    no here it is:
    Attached Files Attached Files

  12. #12
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Code:
    ' 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 Sub ShowResults()
    .
    .
    .
    End Sub
    End Sub
    You can't nest subroutines... and if you're doing "Call Sub ShowResults()" to execute this subroutine, you do not need "Sub" in there. It should just be "Call ShowResults()".
    That which does not kill me postpones the inevitable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •