Message boards, recursion, and ADODB Objects

Results 1 to 2 of 2

Thread: Message boards, recursion, and ADODB Objects

  1. #1
    Bill J Guest

    Default Message boards, recursion, and ADODB Objects

    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 Worst possible way to do it!

    Your board will be even slower than this one, and this one sucks.<BR><BR>*NEVER* use more than *ONE* query to get all the messages you will display. If you must use recursion, convert the recordset to an array (GetRows method) and then work on the array.<BR><BR>Even better: Dump the raw data out to the browser and let client-side JavaScript do the recursion and sorting. Move some of the *huge* load that this kind of stuff is off to the client! Most browsers are sitting there with so much wasted horsepower it is ridiculous.<BR><BR>AND then even better!: Rethink the fields you will put in the messages table and their contents. I have a scheme which *automatically* pulls the entire set of messages (between two given date/time marks) in pre-threaded order. No recursion, no loops, no nothing in the ASP/VBS code...the whole schmear is ready to just plunk into a page. (All you have to add are the "levels" of response, but even that is made easy by the database table format.)<BR><BR>I working on an article on this. Stay tuned.<BR><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