Hi,
I'm trying to set up a treeview function which is populated via a database. I've got a script for the treeview, and I can sort of populate it with values from the database, but it's nowhere near right!
The section which needs the work done (as far as I can tell) is below, and the problem comes when trying to loop around the recordset- I've put stars around the loop function just so you can see it. I've tried putting the loop in various places, but it always comes up with an error referring to the javascript located above it, which controls the tree, saying that part of it is null. At this point, it runs partway through the script, populating some of the fields (sometimes it manages to run further than others, it seems to be random). If anyone could either point out where my looping has gone wrong, or direct me to a script with a similar example, that would be great. Here's the section as it stands:
<%
Set objConn = Server.CreateObject("ADODB.Connection"
Set objRS = Server.CreateObject("ADODB.Recordset"
objConn.Open ("Vendor"
sqltext = "SELECT Equipment.[ID Number] FROM Equipment;"
objRS.CursorLocation = 3 'adUseClient as opposed to adUseServer - use server would return -1
objRS.Open sqltext, objConn
WriteHead "TreeView",1,"Tanks",0,True,False,"",True
**************While Not objRS.EOF**************
WriteHead "TreeView",2,objRS("ID Number"
,1,True,False,"",False
WriteHead "TreeView",3,"A",2,False,False,"",False
WriteFoot
WriteHead "TreeView",4,"B",2,False,False,"",False
WriteFoot
WriteHead "TreeView",5,"C",2,False,False,"",False
WriteFoot
WriteFoot
**************objRS.Movenext**************
**************Wend**************
objRS.Close
objConn.Close
Set objConn = Nothing
%>
I'm trying to set up a treeview function which is populated via a database. I've got a script for the treeview, and I can sort of populate it with values from the database, but it's nowhere near right!
The section which needs the work done (as far as I can tell) is below, and the problem comes when trying to loop around the recordset- I've put stars around the loop function just so you can see it. I've tried putting the loop in various places, but it always comes up with an error referring to the javascript located above it, which controls the tree, saying that part of it is null. At this point, it runs partway through the script, populating some of the fields (sometimes it manages to run further than others, it seems to be random). If anyone could either point out where my looping has gone wrong, or direct me to a script with a similar example, that would be great. Here's the section as it stands:
<%
Set objConn = Server.CreateObject("ADODB.Connection"
Set objRS = Server.CreateObject("ADODB.Recordset"
objConn.Open ("Vendor"
sqltext = "SELECT Equipment.[ID Number] FROM Equipment;"
objRS.CursorLocation = 3 'adUseClient as opposed to adUseServer - use server would return -1
objRS.Open sqltext, objConn
WriteHead "TreeView",1,"Tanks",0,True,False,"",True
**************While Not objRS.EOF**************
WriteHead "TreeView",2,objRS("ID Number"
WriteHead "TreeView",3,"A",2,False,False,"",False
WriteFoot
WriteHead "TreeView",4,"B",2,False,False,"",False
WriteFoot
WriteHead "TreeView",5,"C",2,False,False,"",False
WriteFoot
WriteFoot
**************objRS.Movenext**************
**************Wend**************
objRS.Close
objConn.Close
Set objConn = Nothing
%>