ASP error after fixing CSS and HTML

Discussion in 'C#' started by gilgalbiblewheel, Jun 18, 2007.

  1. #1
    When I thought of fixing the CSS and HTML, the ASP section gave me this error:
    Line 94 is the last line in Yellow Green.
    <%'Option Explicit%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    	<head>
    		<title>Read the King James Bible</title>
            <script language="JavaScript" type="text/javascript">
            <!--
    			function go(action) {
    			// set variables pointing to the two forms we need
    				var theForm = document.forms["myForm"];
    				var otherForm = window.parent.document.forms["myForm"];
    			// construct the "search" part of the URL from all the elements
    				var query = "?Book=" + theForm.Book.options[theForm.Book.selectedIndex].value;
    				query += "&Chapter=" + theForm.Chapter.options[theForm.Chapter.selectedIndex].value;
    			// test to see if a verse has been selected, if not we won't pass the values
    				if( theForm.verse.selectedIndex != -1 ) {
    					for( var i=0; i < theForm.verse.options.length; i++ ) {
    						if( theForm.verse.options[i].selected ) {
    							query += "&Verse=" + theForm.verse.options[i].value;
    							}
    						}
    					}
    
    			query += "&Keyword=" + escape(otherForm.Keyword.value);
    			query += "&Keywordb=" + escape(otherForm.Keywordb.value);
    			query += "&Keywordc=" + escape(otherForm.Keywordc.value);
    			query += "&Keywordd=" + escape(otherForm.Keywordd.value);
    			query += "&Keyworde=" + escape(otherForm.Keyworde.value);
    			query += "&Keywordf=" + escape(otherForm.Keywordf.value);
    
    			// either redirect this page or the child frame depending on which select was changed
    			if(action == "refresh") {
    				location.href = "postinforummenu.asp" + query;
    			} else {
    				ifrVerse.location.href = "postinforum.asp" + query;
    			}
    			
    		}
    		//-->
    		</script>
    	</head>
    	<body>
    	<%
                Dim Book
                Dim Chapter
                Dim Verse
    
                Dim DSNName
                Dim Conn
                Dim RS
                Dim SQL1
    
    			Dim Keyword
    	%>
    	<table border="0">
    		<td>
    			<form name="myForm" action="postinforum.asp" method="get" target="ifrVerse">
    	          <table border="0" bgcolor="#c6bd8a">
    
                     <tr>
    	                 <th colspan="1" style="text-align:center;" color="black">book</th>
    	                 <th colspan="1" style="text-align:center;" color="black">chapter</th>
                     </tr>
                     <tr>
     	                <td>
    [COLOR="YellowGreen"]						<%
    		                	'This function checks to see that numerical values are valid
                     			Function ValidateInt(SomeInt)
    								if IsNumeric(SomeInt) = False or SomeInt = "" then
    									SomeInt = 1
    								end if
    								ValidateInt = SomeInt
    							End Function
    							'Setting up search variables
    							Book        = ValidateInt(request("book"))
    							Chapter     = ValidateInt(request("Chapter"))
    							Verse       = request("Verse")
                
    				            'Setting up my database variables
    
    							DSNName = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="
    							DSNName = DSNName & Server.MapPath("kjv.mdb")
    							DSNName = DSNName & ";PWD=" & "mypass"
    							
    							'Opening Database connection
    							Set Conn = Server.CreateObject("ADODB.Connection")
    							Conn.Open DSNName
    							
    							set RS = Server.CreateObject("ADODB.recordset")
    							
    							'This SQL statement creates a list of books
    							SQL1 = "Select DISTINCT(Book_Title), Book FROM Bible ORDER BY Book ASC"
    							
    							rs.Open sql1,conn, 1
                    %>[/COLOR]
    			<input type="hidden" name="Keyword" value="" />
    			<input type="hidden" name="Keywordb" value="" />
    			<input type="hidden" name="Keywordc" value="" />
    			<input type="hidden" name="Keywordd" value="" />
    			<input type="hidden" name="Keyworde" value="" />
    			<input type="hidden" name="Keywordf" value="" />
    
                <a name="bcv"><select name="Book" size="5" style="width:150px;" onChange="go('refresh');"></a> 
    			<%'onChange="grabKeywords();go1();"%>
                <%Do until RS.eof%>
    			<option <%if int(book) = int(RS("Book")) then response.write "selected" end if%> value="<%=RS("Book")%>"><%=RS("Book_Title")%></option>
                            <%
                            RS.movenext
                            if RS.eof then
                                exit do
                            end if
                        loop
                        %>
                        </select>
                <%
                RS.Close
                %>
            </td>
            <td colspan="1" style="text-align:center;">
                <%
                'This SQL statement creates a list of books
                SQL1 = "Select DISTINCT(Chapter), Book FROM Bible WHERE Book = " & Book & " ORDER BY Chapter ASC"
                rs.Open SQL1,Conn, 1
                    %>
                    <select name="Chapter" size="5" style="width:75px;" onChange="go('refresh');" <%'onChange="go2();"%>>
                    <%
                    Do until RS.eof
                        %>
                        <option <%if int(Chapter) = int(rs("Chapter")) then response.write "selected" end if%> value="<%=RS("Chapter")%>"><%=RS("Chapter")%></option>
                        
                        <%
                        rs.movenext
                        if rs.eof then
                            exit do
                        end if
                    Loop
                    %>
                    </select>
                    <%
                rs.close
                
                %>
            </td>
            </tr>
            <td colspan="2" style="text-align:center;">
                <%
                'This SQL statement creates a list of verses
                SQL1 = "Select Verse FROM Bible WHERE Book = " & Book & " AND Chapter = " & Chapter & " ORDER BY Verse ASC"
                'SQL1 = "Select DISTINCT(Verse), Book, Chapter FROM Bible ORDER BY Verse ASC"
                rs.Open SQL1,Conn, 1
                    %>
            </td>
    
    
        </tr>
        <tr colspan="2" style="text-align:center;">
            <th colspan="3" style="text-align:center;" color="black">
                verse
            </th>
        </tr>
            <td colspan="2" style="text-align:center;">
            
                    <select multiple name="verse" size="5" style="width:120px;" onChange="go('update');" <%'onChange="go3();"%>>
                    <option <%'if verse = "" then response.write "selected" end if%> value="all">(All Verses)</option>
                    <%
                    Do until RS.eof
                        %>
    <%'                   <option <%if int(verse) = int(rs("verse")) then response.write "selected" end if%> value="<%=RS("verse")%>"><%=RS("verse")%></option>
    <option <%if Cint(verse) = Cint(rs("verse")) then response.write "selected"%> value="<%=RS("verse")%>"><%=RS("verse")%></option>                    
                        <%
                        rs.movenext
                        if rs.eof then
                            exit do
                        end if
                    Loop
                    %>
                    </select>
                    <%
                rs.close
                
                Conn.close
                %>
              </td>
    <%'          <tr>
    '        <td colspan="4" style="text-align:center;">
    '            <input type="submit" value=" Search " onClick="go('update');">
    '            <input type="Reset" value=" Clear ">
    '        </td>
    '    </tr>
    %>
        <tr>
            <td style="text-align:center;" colspan="2">
                <iframe name="ifrVerse" id="ifrVerse" src="blank.asp" style="height:800px; width:250px;border:0;" frameborder="0"></iframe>
            </td>
        </tr>
    </table>
    </form>
    
    
    </td>
    </table>
    </body>
    </html>
    Code (markup):

     
    gilgalbiblewheel, Jun 18, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Throwing an error on the SQL Open Query - I think it's your query that's screwed up.

    Select DISTINCT(Book_Title), Book FROM Bible ORDER BY Book ASC
    should be
    Select DISTINCT Book_Title, Book FROM Bible ORDER BY Book
     
    ccoonen, Jun 18, 2007 IP
  3. gilgalbiblewheel

    gilgalbiblewheel Well-Known Member

    Messages:
    435
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    I don't know. I went to my other computer tried it out and it worked. I came back and tried it on this computer and it worked. But prior to that, I refreshed it many times ( on FireFox ) and it gave problems. It seems to be working now. Thanks.
     
    gilgalbiblewheel, Jun 18, 2007 IP