Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compilation error??

    Hi,

    I get this erroe mess:

    Compilation Error in Microsoft VBScript (0x800A03F6)
    'End' is Expected
    /main.asp Line 337

    Line 337:

    Code:
    <%End If%>
    and here's all the code I think is relevant:

    Code:
    	 <%If Request.QueryString("cat") = "" Or Request.QueryString("cat") = "om" Then
           If Request.QueryString("ucat") = "presentation" Then%>
    
          Presentation
    
          <%ElseIf Request.QueryString("ucat") = "styrelsen" Then%>
    
          Styrelsen
    
          <%ElseIf Request.QueryString("ucat") = "historia" Then%>
    
          Historia
    	  
    	  <%ElseIf Request.QueryString("ucat") = "meriter" Then%>
    	  
    	  Meriter
    	  
    	  <%ElseIf Request.QueryString("ucat") = "mastare" Then%>
    	  
    	  Mästare genom åren
    	  
    	  <%ElseIf Request.QueryString("ucat") = "banor" Then%>
    	  
    	  Våra banor
    
          <%End If
            ElseIf Request.QueryString("cat") = "medlem" Then
    		If Request.QueryString("ucat") = "attvara" Then%>
    
          Att vara medlem
    	  
    	  <%ElseIf Request.QueryString("ucat") = "bli" Then%>
    	  
    	  Bli medlem
    	  
    	  <%ElseIf Request.QueryString("ucat") = "paragrafer" Then%>
    	  
    	  Rättigheter & skyldigheter
    	  
    	  <%ElseIf Request.QueryString("ucat") = "arrangemang" Then%>
    	  
    	  Medlemsarrangemang
    	  
            <%End If
            ElseIf Request.QueryString("cat") = "tavling" Then
            If Request.QueryString("ucat") = "info" Then%>
    
           Tävlingsregler & info för ickemedlemmar
    
           <%ElseIf Request.QueryString("ucat") = "schema" Then%>
    
           Spelschema
    	   
    	   <%ElseIf Request.QueryString("ucat") = "resultat" Then%>
    	   
    	   Resultatbörs
    	   
    	   <%ElseIf Request.QueryString("ucat") = "lagspel" Then%>
    	   
    	   Lagspel (Div 3, Stockholmsserien Lag 1, ??Stockholmsserien Lag 2??)
    
           <%End If
           ElseIf Request.QueryString("cat") = "lankar" Then
    	   If Request.QueryString("ucat") = "sverige" Then%>
    	   
           Svenska länkar
    	   
    	   <%ElseIf Request.QueryString("ucat") = "utland" Then%>
    	   
    	   Utländska länkar
    	   
    	   <%ElseIf Request.QueryString("ucat") = "butiker" Then%>
    	   
    	   Webb butiker
    	   
    	   <%ElseIf Request.QueryString("ucat") = "annat" Then%>
    	   
    	   Övriga länkar (puttabra)
    
           <%End If
    	   ElseIf Request.QueryString("cat") = "forum" Then
    	   If Request.QueryString("ucat") = "forum" Then%>
    	   
    	   Forum
    	   
    	   <%End If
    	   ElseIf Request.QueryString("cat") = "kontakt" Then
    	   If Request.QueryString("ucat") = "klubben" Then%>
    	   
    	   Kontakta klubben (Adress, Telefon, PG, Org.nr)
    	   
    	   <%ElseIf Request.QueryString("ucat") = "styrelsen" Then%>
    	   
    	   Styrelsen
    	   
    	   <%ElseIf Request.QueryString("ucat") = "ungledare" Then%>
    	   
    	   Ungdomsledare
    	   
    	   <%End If%>   <-- LINE 337
    Does anyone see what I'm missing??

    All help appreciated, thanks
    /Speedy
    Last edited by Speedy; 12-21-2003 at 02:56 AM.

  • #2
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've solved it!

    I had to add a few extra <%End If%>'s.
    I'm way to tired to be coding right now (4:30AM) zzzzzzz

    /Speedy

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Using indentation makes finding problems like this much easier.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Originally posted by Roy Sinclair
    Using indentation makes finding problems like this much easier.
    Quite so, and since you are only writing one word out, it would be better to just use Response.Write instead of switching in and out of the <% ... %> tags.
    OracleGuy

  • #5
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    a else if after a end if works? I quess I should try the code out, but I can't imagine doing it.

    Code is question (modified from above):
    Code:
    <%
    	If Request("foo") = "foo" Then
    		Response.write ("foo")
    	Elseif Request("foobar") = "foobar" Then
    		Response.write ("foobar")
    	End If
    	Else If Request("wtf") = "wtf" Then
    		Response.write ("wtf")
    	End If
    %>

  • #6
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    if you look closely at Speedy's code you will see that the very first If/Else statement is never closed with an End If, instead he nested If/Else statements inside the first If/Else statement. it was the second level If/Else that he was closing. As Oracleguy posted, using indentation would have eliminated this problem. The code Oakendin is showing will throw an error.

  • #7
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What's Indentation?

    /Speedy

  • #8
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Speedy
    What's Indentation?

    /Speedy
    Indentation?
    Code:
    well, you could say that that
       is me 
            and me also
       etc etc
    but not me
    (it's adding spaces in front of new lines after an if or else clause etc and the oposite if you closed a clause.)
    So you then need to end at the left border if all clauses or closed, end you can immedeately see which clause or lopp or ... starts and ends where.

    If you use a good editor, the you'll automaticaly indent and 'outdent' on new lines after a control of flow statement

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh man... speedy, for humankind's sake, and your own - not to mention any developers that might have to work on your code in the future, please indent your code.

    Something like:
    Code:
    If a = b Then
        'do something
    Else
       If b = c Then
           'do something else
            If c = d Then
                'do something else entirely
            End If
        End If
    End If
    Otherwise you run into the problem you just ran into. Some experience with JavaScript, C++, C or any other strict programming language will cure you of that problem. I'd suggest taking the webmonkey tutorials on javascript and making some mock forms for practice, validating them using javascript.

    I don't mean to offend by the above message, but I sometimes have to fix old websites where people didn't indent their code, and in order to figure it out, I spend 20-30 minutes just indenting and formatting code so it's readable. Not indenting your code is a great way to avoid making friends of fellow programmers.
    Last edited by whammy; 12-25-2003 at 04:04 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I should also point out that proper indentation makes troubleshooting your own code much easier.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by whammy
    I should also point out that proper indentation makes troubleshooting your own code much easier.
    Er, that was my point
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #12
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah Roy I saw you said it first

    I also wanna say I use to indent my code but sometimes
    it doesn't get right in the forums cause Dreamweavers auto
    indentation really su**s everywhere but in Dreamweaver
    itself.

    I just didn't know what the word indent meant...I'm just a swede who doesn't know every single english word

    /Speedy

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When I first started coding (as a job) I used coding forms and pencils (a good old Pentel .05 ) which then had to be keypunched, then I'd check the cards, make any corrections using another coding form and finally submit the program for compilation. I used few lines of code which meant minimal indentation and variable names that were as short as possible.

    After a couple years we got individual CRTs (dumb terminals) and even though I could only see 24 lines of the program at a time on the CRT I quickly found that indentation and long very descriptive variable names were so valuable that all my earlier programming efforts were embarassing to work on (and would get reformatted as the first step of any work on them).

    I can still read code that's poorly formatted because I come across it all the time but well formatted code (even when it uses a slightly different standard for formatting than I prefer) is always a lot nicer to work with.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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