Picking Records with children!

Results 1 to 2 of 2

Thread: Picking Records with children!

  1. #1
    Xavioure! Guest

    Default Picking Records with children!

    I want to pick all recs along with their children!This is the structure of my table!<BR><BR>FolderID:<BR>FolderName:<BR>ParentID :<BR>DriveID:<BR><BR>I am basically trying to generate a tree structure,can anybody help!! Regards!

  2. #2
    Join Date
    Dec 1969

    Default Really can't be done...

    ...with that kind of table structure.<BR><BR>Oh, you *can* do it by getting all the records that have no ParentID and then looping through that recordset. Then, for each "top level" record, you get all the records that have it as a parent. And so on, recursively. It means that you end up having one recordset opened and closed *FOR EACH AND EVERY RECORD THAT IS A PARENT* (plus the starting one).<BR><BR>SLOW SLOW SLOW CLUMSY CLUMSY CLUMSY.<BR><BR>Don&#039;t do it!<BR><BR>A better way:<BR><BR>Get all the records into a 2D array using ADODB.RecordSet.GetRows and then use VBScript to recursively scan the array building the tree.<BR><BR>An even better way:<BR><BR>Get all the records into an array of arrays in CLIENT-SIDE JavaScript and then use JS coding *in the browser* to recursively scan the array and build the tree. This way, you move all the ugly and time consuming processing off the server and onto the (relatively) unburdened client computer.<BR><BR>But the middle way, using a 2D array and VBS code, is reasonably acceptable.<BR><BR>I hope you understand recursion?<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