nested loops

P

pigsy101

HI 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=*****;Database=******"

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
%>

<html>
<head>
<title>IT Software Licensing</title>
<link href="/includes/intranet.css" rel="stylesheet" type="text/
css">

<style type="text/css" media="screen">

#maindiv
{
width:750px;
}

</style>
<style type="text/css" media="print">

#maindiv
{
width:100%;
}

</style>



<center>
<div id=maindiv>
<table width=100% cellpadding="0" cellspacing="0" border="1"
align="center">
<tr><td>
<!-- #include virtual="/includes/headermb.asp" -->
</td></tr>


<tr>
<td align="center" bgcolor="#9ba8d0">
<br>
<table width="95%" bgcolor="#efefef" cellpadding="5" cellspacing="0"
border="1">
<tr>
<td><span class="title1"><img src="/images/icons/
mouse.png"><small><small> Software Licensing</small></small></span></
td>
</tr>
<tr>
<td>
<!-- #include file="navbar.inc" -->
</td></tr>
</table>
<br>
<table width="95%" bgcolor="#efefef" cellpadding="5"
cellspacing="0" border="1">
<tr>
<td class="normalsize">
<table width="100%" bgcolor="#efefef" cellpadding="5"
cellspacing="0" border="1">
<tr class="normalsize"><td><b>Software</b></
td><td><b>Computer</b></td></tr>

<% Do While Not rsSoftwareList.EOF %>
<tr class="normalsize"><td valign="top"><% =
rsSoftwareList.Fields("fldDeveloper") & " " &
rsSoftwareList.Fields("fldProduct") & " " &
rsSoftwareList.Fields("fldVersion") %></td><td valign="top">


<li><% = rssoftwareList.Fields("inventorynumber") & " - " &
rssoftwareList.Fields("description") & " - " &
rssoftwareList.Fields("pcname") %>






</td></tr>



<% rsSoftwareList.MoveNext %><% Loop %>
</table>
<br>
</td>
</tr>
</table>

<br>

</td>
</table>
</div>
</center>
</body>
</html>


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
 
M

Mark Rae

First time here so thanks in advance.

I have a .asp page

You're in the wrong newsgroup - this one is for ASP.NET.

For ASP issues, please post to:
microsoft.public.inetserver.asp.general
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top