E' già pronta:
il risultato è questo
il codice che ho usato per ottenerla è
codice:
<%
cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/mdb-database/HRcafe.mdb")
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open cstring
Set rs = Server.CreateObject("ADODB.Recordset")
id = "menu"
SQL = "SELECT id, padre from menu"
rs.Open sql, objConn, 3, 3
if rs.eof then
%>
<center><table border="0" width="80%">
<tr>
<td align="center">Niente dati</td>
</tr>
</table>
</center>
<%
else
%>
<center>
<table class="gialloc" border="1" cellspacing='1' cellpadding='1' width="50%">
<tr>
<td width="10%" align="center">ID</td>
<td width="10%" align="center">PADRE</td>
<td width="30%" align="center">FIGLI DI QUESTO PADRE</td>
</tr>
<%
dim conteggio() 'dichiaro l'array
totale = rs.recordcount
redim conteggio(totale) 'ridimensiono l'array in base al numero dei records
do until rs.eof
id = rs("id")
padre = rs("padre")
if padre then
questo = cint(padre)
conteggio(questo) = conteggio(questo) + 1
end if
rs.movenext
loop
rs.movefirst 'riporto il cursore al primo record
do until rs.eof
id = rs("id")
padre = rs("padre")
if padre then
questo = cint(padre)
tot = conteggio(questo)
end if
%>
<tr>
<td align="center"><%=id%></td>
<td align="center"><%=padre%></td>
<%
if padre then
%>
<td align="center"><%=tot%></td>
<%
else
%>
<td></td>
<%
end if
%>
</tr>
<%
rs.movenext
loop
%>
<%end if%>
</table>
</center>
<%
rs.close
set rs=nothing
'chiudo tutto
objConn.close
set objconn=nothing
%>