nested loops
am 02.07.2007 11:14:12 von pigsy101HI all.
First time here so thanks in advance.
I have a .asp page which is displaying the software we have and which
computers this software is installed on.
The code below works fine but i want to put a nested loop in so it
only displays one instance of the software and then lists all the
computers which has it installed and then loop on to the next software
etc etc etc.
Please can someone help as i don't know how to add this additional
loop.
code:
<% set dbConn = server.createobject("adodb.connection")
dbConn.open
"Provider=****;Server=****;UID=intranetlogin;PWD=*****;Datab ase=******"
Set rsEquipmentList = Server.CreateObject("ADODB.Recordset")
Set rsSoftwareList = Server.CreateObject("ADODB.Recordset")
sql = ""
sql3 = "SELECT mbSoftware.id, mbSoftware.fldDeveloper,
mbSoftware.fldProduct, mbSoftware.fldVersion,
mbSoftwareInstallation.fldhardware, equipment.inventorynumber,
equipment.description, equipment.pcname FROM (mbSoftware INNER JOIN
mbSoftwareInstallation ON mbSoftware.id =
mbSoftwareInstallation.fldsoftware) INNER JOIN equipment ON
mbSoftwareInstallation.fldhardware = equipment.inventorynumber ORDER
BY mbSoftware.fldDeveloper, mbSoftware.fldProduct,
mbSoftware.fldVersion, equipment.inventorynumber"
rsEquipmentList.open sql, dbConn, 3, 3
rsSoftwareList.open sql3, dbConn, 3, 3
%>
td>
td>
<% Do While Not rsSoftwareList.EOF %>
rsSoftwareList.Fields("fldDeveloper") & " " &
rsSoftwareList.Fields("fldProduct") & " " &
rsSoftwareList.Fields("fldVersion") %>
rssoftwareList.Fields("description") & " - " &
rssoftwareList.Fields("pcname") %>
<% rsSoftwareList.MoveNext %><% Loop %>
I have a feeling i need to add an extra sql statement to "sql = """
and use rsequipmentlist as the second loop but i don't know how to
link the two sql statements
Any help will be gratefully accepted.
Thanks
Pigsy101