Page 1 of 3 123 LastLast
Results 1 to 15 of 41
  1. #1
    Join Date
    Jul 2004
    Posts
    494

    Unanswered: my database-asp not functioning something wrong with the table I think

    There's something wrong in this:

    Code:
    <%
     '*************************************************
    ***********************************
    '* ADO Recordset Paging Sample Script
    '* by Konstantin Vasserman
    '* June 2000
     '*************************************************
    ***********************************
    
    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
    
    ' Shows HTML page header 
    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
    
    ' Shows HTML page footer 
    Public Function OutputPageFooter()
    	%>
    	</BODY>
    	</HTML>
    	<%
    End Function
    
    ' This function will display the search form
    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

    TO BE CONTINUED...PART 2

  2. #2
    Join Date
    Jul 2004
    Posts
    494

    PART 2 OF THE CODE + the ERROR

    Code:
    ' 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 "    "
    
    		' 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 "    "
    	
    		' 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 "    "
    
    		' 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)
    			
    
    
    
      <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>
    
    </table>
    
    
    			' 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
    
    	' 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 307

    <table BORDER="0" width="100%" cellpadding="3">
    ^

  3. #3
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    looks to me like you aren't closing your asp tags before going into your html....

    you need a %> on the line above that line.

  4. #4
    Join Date
    Jul 2004
    Posts
    494

    ok thanks...what about this?

    Microsoft VBScript compilation error '800a0400'

    Expected statement

    /bible5.asp, line 355

    End If
    ^

  5. #5
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    basically that is the same problem. you are not jumping into and out of you asp at the right points. look at you code and check all your asp tags and make sure you are opening them and closing them where you should be.

    If it still doesn't work post the revised code as an attachment with the error and we can have another loko at it.

  6. #6
    Join Date
    Jul 2004
    Posts
    494

    Sorry I'm a newbie and and put together a couple of codes

    I've tried inserting end ifs here and there but didn't work out.
    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
    
    ' Shows HTML page header 
    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
    
    ' Shows HTML page footer 
    Public Function OutputPageFooter()
    	%>
    	</BODY>
    	</HTML>
    	<%
    End Function
    
    ' This function will display the search form
    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
    '************************************************************************************
    %>

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    it's not your end if's that are the problem it's the <% and %> tags. You are leaving them open and/or not opening them at the right time....

    So some of you html is trying to be read as asp and some of you asp is being treated as html....

  8. #8
    Join Date
    Jul 2004
    Posts
    494

    I couldn't figure out because

    because even in html I'm not too familiar. I printed out the original samples from which I combined this. Each shows different methods so I don't know if <% / %> comes before or after certain statements.

  9. #9
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    *sigh* so is the above code a full listing of your page now??

  10. #10
    Join Date
    Jul 2004
    Posts
    494

    most probably at the end of the code

    I think it's somewhere at the end of the code near the "loop" but don't know the exact location because this code has some extra stuff, comparing with the other code.

  11. #11
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    attached is the corrected code as far as <% and %> tags are concerned.
    Attached Files Attached Files

  12. #12
    Join Date
    Jul 2004
    Posts
    494

    so far yes

    so far yes. But I plan on adding emboldened keywords. I used to have it in but I had restarted because it got too complicated. But it's searching quickly compared to the html/asp page that I had.

    I used this because there was a sample code on pageing and record counting. And it was done all in one page.

  13. #13
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    some advice..... rather then just taking examples and trying to change them to suit your needs and asking for help with everything that you run into the slightest probelm with,.... spend a few days and understand exactly what it is you are doing with your asp and html.

    once you understand what you are doing you will see it's not really that complicated at all and you should also find that you are able to solve your own problems faster then we can try and stop them here....

  14. #14
    Join Date
    Jul 2004
    Posts
    494

    this is where problems started kicking in

    This was from someone else's advice on adding checkboxes' functions. It worked on the other pages. But here, it's giving problems especially on forming the table for the results.

    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

  15. #15
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    well what you are saying is pretty much impossbile..... this particular bit of code does not write anything out to html so it won't affect an html table (assuming it is tagged correctly as asp and not as html). All that bit of code does is check and see what controls have been checked.

    What is the problem you are experiencing. Is this online somewhere so I can see what is happening?

Posting Permissions

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