Message Boards and Recursion

Results 1 to 4 of 4

Thread: Message Boards and Recursion

  1. #1
    Bill J Guest

    Default Message Boards and Recursion

    I&#039m atempting to write a message board in asp that uses recursion to draw the posts and thier child posts, that pulls the posts out of a database.<BR><BR>To do this I&#039ve writtena a function that&#039s only variable is a the parent Id, it then does a SQL query to pull a recordset that contains all of the records that are childs of that particular parent id. It writes the information for the first message. It then, while in the function, calls itself with the id of the child, so that when the functin loads again it pulls the child items of the current item. <BR><BR>What I&#039m wondering is whether on the next call whether or not the recordset is written over or wether a new recordset is spawned, if it&#039s written over I&#039ll only get the first "branch", if not then it will function correctly.<BR><BR>So how does a recursive function in ASP deal with Recordset objects? and how does the recordset object persist in memory?<BR><BR>Bill J

  2. #2
    Join Date
    Dec 1969

    Default RE: Message Boards and Recursion

    Bill,<BR><BR>Interesting issue, I am on the finishing end of my message board, my initial design was to use recursion to display the messages, and recursion is fun, considering a mb is a classic parent child tree type relationship.<BR><BR>I will give you a quick and much better way to do this, at least I cannot find any problems yet.<BR><BR>Have a sequence number in your table that contains the messages in order,<BR>and a level attribute (aka how far to indent)<BR>and order the messages on the way in. <BR>display becomes rather easy.<BR><BR>If you need more info on my system, I will be glad to share it with you. Recursion is a real cool thing, but a real pain to figure out. <BR><BR>This was just an aside that I came up with.<BR><BR>g.l.<BR>Zach

  3. #3
    Skippie Guest

    Default RE: Message Boards and Recursion

    The recordset object stays in memory until the function that<BR>created the recordset object closes it. If it didn&#039t stay in <BR>memory, then the recursion wouldn&#039t work.<BR><BR><BR>-- Skippie

  4. #4
    Join Date
    Dec 1969


    and it&#039s still a bad idea to use more than one SQL call to get the whole thing.

Posting Permissions

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