Nesting Do....Loop statements?

Results 1 to 3 of 3

Thread: Nesting Do....Loop statements?

  1. #1
    Zola Guest

    Default Nesting Do....Loop statements?

    I would like to include a do...loop statement within a do...loop statement. Basically, it is simply a query within a query that cannot be handled by an SQL statement alone. When I add the second loop, however, it seems as though the first gets stuck and jus produces row after row of empty results.<BR><BR>Do I need to somehow pause the first loop so the second can run? If yes, how? <BR><BR>TIA<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Nesting Do....Loop statements?

    Seemingly you have a loop which isnt terminating in the way you want, this is most likely a problem with the structure of your coding, not the actual fact that there are nested loops.<BR><BR>If you could you be a little more specific as to what youre trying to do it would be easier to help.<BR><BR>Chris.

  3. #3
    Zola Guest

    Default RE: Nesting Do....Loop statements?

    I am coding my own BB =)<BR><BR>The first loop gets all the main posts, and then subsequent loops for the replies and the replies to the replies and so forth.<BR><BR>So the statement would begin: &#060;%Set rsPosts = Server.CreateObject("ADODB.Recordset")<BR> sql = "SELECT BulletinBoard.PostID, BulletinBoard.Name, BulletinBoard.Email, BulletinBoard.Subject, BulletinBoard.ResponseTo, BulletinBoard.BBDate, BulletinBoard.BBTime FROM BulletinBoard WHERE ResponseTo = 0 ORDER BY BBDate DESC"<BR> sql, conn, 3, 3<BR>PostID = rsPosts("PostID")%&#062;<BR>&#060;%<BR>On Error Resume Next<BR>rsPosts.MoveFirst<BR>do while Not rsPosts.eof<BR> %&#062;<BR><BR>I then format the display and the loop ends:<BR>&#060;%<BR>rsPosts.MoveNext<BR>loop%&#062 ;<BR><BR><BR>I would like to insert another loop that does basically the same thing so that I can then get the responses to the main posts, and so on.<BR><BR>TIA =)<BR>

Posting Permissions

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