Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2004, 08:22 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default Do While Loop Problems

This is part of the code i have and i keep getting the following error with my Loops:

Microsoft VBScript compilation error '800a040e'

'loop' without 'do'

/default.asp, line 72

Loop
^

This is the SCRIPT:

    Do While Not Cat.EOF
        If Session("CatID"&Cat("CatID")) = "Y" Then
            Display = "N"
            Image = "images/icon_minus.gif"
        Else
            Display = "Y"
            Image = "images/icon_plus.gif"
        End If
        If Session("CatID"&Cat("CatID")) = "Y" Then
        SubCat.Open "Select * from SubCategories Where CatID="&Cat("CatID"),ObjConn,1,2
        Response.Write("<tr bgcolor=#CCCCCC>")
            Response.Write("<td colspan=6><a href=default.asp?CatID="&Cat("CatID")&"&Display="& Display&"><img src="&Image&" border=0></a> "&Cat("CatName")&"</td>")
            Response.Write("<td>&nbsp;</td>")
        Response.Write("</tr>")
        Do While Not SubCat.EOF
            Response.Write("<tr>")
                Response.Write("<td>&nbsp;</td>")
                Response.Write("<td><a href=forum.asp?ForumID="&SubCat("SubCat")&">"&SubC at("SubCatName")&"</a><br>"&SubCat("SubCatDesc")&"<td>")
                Response.Write("<td>"&SubCat("TotalTopics")&"</td>")
                Response.Write("<td>"&SubCat("TotalPosts")&"</td>")
                Response.Write("<td>&nbsp;</td>")
                Response.Write("<td>&nbsp;</td>")
                Response.Write("<td>&nbsp;</td>")
            Response.Write("</tr>")
        SubCat.MoveNext
        Loop
        SubCat.Close
        Set SubCat = Nothing
    Cat.MoveNext
    Loop
    Cat.Close
    Set Cat = Nothing

 
Old August 8th, 2004, 08:31 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  You forgot END IF for the seconf IF statement.

 
Old August 8th, 2004, 08:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi gmoney060,

When such errors are shown, it is always a good practice to check for the code around/within construct(for/while/if) so as to check if you have missed something/forgot to close the other construct. Sometimes the entire code has to be looked into. It is not that always the error would be related to the line it shows up for such CONSTRUCT related errors.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help with loop... cbtidball Access VBA 4 February 22nd, 2006 09:55 AM
Loop Problems tready Excel VBA 1 November 15th, 2005 02:37 AM
For loop problems cube Beginning VB 6 2 November 29th, 2004 04:01 PM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.