Intention is that a database with only one table is read, which contains all
members of a family. The table contains a parent-child id as well, so,
knowing the most toplevel (which is the starting point) it is possible to
drilldown to the youngest member in the family.
I build the same stuff into VB itself (v6) and that works fine.
Code is as follows:
<%@ LANGUAGE="VBSCRIPT"%>
<%
Response.Expires = -1
dq = Chr(34)
'Open connection to database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ=D:\Inetpub\webdata\family.mdb;Driver={Microsoft Access Driver
(*.mdb)};DriverId=25;FIL=MS Access;"
Sub main()
Dim First_Node
First_Node = "F235M234"
Call Retrieve_Tree(First_Node)
End Sub
Sub Retrieve_Tree(Parent)
SQLStr = "Select ID, PartnerID, MarriageID, IDParentMarriage, Lastname,
FirstName from Persons where IDParentMarriage = '" + Parent + "' ORDER BY
DateOfBirth"
Set rs = Conn.Execute (SQLStr)
If rs.EOF Then
Exit Sub
End If
If Not rs.EOF Then
rs.MoveFirst
End If
While Not rs.EOF
strName = rs("Lastname") & ", " & rs("Firstname")
OwnID = rs("MarriageID")
ParentID = rs("IDParentMarriage")
'Nu afdrukken, maar ook functie aanroepen die TreeView1 object vult, met
parameters
'Response.Write strName & "<BR>"
Call FillTreeNew (OwnID, ParentID, strName,4)
Response.Write "<BR>"
Call Retrieve_Tree (rs("MarriageID"))
rs.MoveNext
Wend
End Sub
%>
<SCRIPT LANGUAGE="VBScript">
<%
Sub FillTreeView(OwnID,ParentID,strName)
Response.Write "TreeView1.Nodes.Add " & dq & ParentID & dq & ",tvwChild,"
& dq & OwnID & dq & "," & dq & strName & dq
End Sub
%>
</SCRIPT>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 4</title>
<LINK HREF="/Stylesheets/content.css" REL="STYLESHEET" TYPE="TEXT/CSS">
</head>
<body>
<OBJECT ID="TreeView1" WIDTH=400 HEIGHT=500
CLASSID="CLSID:0713E8A2-850A-101B-AFC0-4210102A8DA7">
<PARAM NAME="_ExtentX" VALUE="7938">
<PARAM NAME="_ExtentY" VALUE="10583">
<PARAM NAME="_Version" VALUE="327682">
<PARAM NAME="LineStyle" VALUE="1">
<PARAM NAME="Style" VALUE="6">
<PARAM NAME="Appearance" VALUE="1">
</OBJECT>
<p>Content</p>
<HR>
<%
FillTreeNew "F235M234","NULL","STAALBERG, Hendrik", 0
Response.Write "<BR>"
Main
%>
<SCRIPT LANGUAGE="VBScript">
TreeView1.Font.Name = "Tahoma"
TreeView1.Font.Size = 9
TreeView1.Nodes.Add "NULL",0,"F235M234","STAALBERG, Hendrik"
<%
Sub FillTreeNew(OwnID,ParentID,strName,Prm)
'************ Populate the Control ******************************
Response.Write Chr(10) & "TreeView1.Nodes.Add " & dq & ParentID & dq &
"," & Prm & "," & dq & OwnID & dq & "," & dq & strName & dq & chr(10) &
chr(13)
End Sub
%>
</SCRIPT>
<%
Conn.Close
Set rs = Nothing
Set Conn = Nothing
%>
</body>
</html>