intanto prova questo, spero di non aver fatto errori di sintassi. cambia le parti che devi cambiare (come CONNESSIONE sostiuiscila con una variabile di connessione appropriata)
codice:<% sql="select t1.campo1 as campo1,t1.campo2 as campo2,t1.campoX as campoX,t1.cod_caratteristica as codice,t1.valore_caratteristica as valore" sql=sql & " t2.descrizione_caratteristica as descr from tabella_anagrafica t1, tabella_descrizione t2 where t1.cod_caratteristica=t2.cod_caratteristica" set rs=server.CreateObject("adodb.recordset") rs.open sql, CONNESSIONE,3,3 'conto i record trovati dim TOT TOT=0 while not rs.eof TOT=TOT+1 rs.movenext wend if TOT<>0 then sql="select count(*) from tabella_caratteristiche group by codice_caratteristica" set rs1=CONNESSIONE.execute(sql) if not rs1.eof then TOT_C=rs1(0) end if rs1.close : set rs1=nothing redim arrayRs(TOT,TOT_C) rs.movefirst i=0 while not rs.eof for j=0 to TOT_C if cint(rs("codice"))=j then arrayRs(i,j)=rs("valore") else arrayRs(i,j)="" end if next i=i+1 rs.movenext wend 'stampo la tabella %> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td>Primo Campo</td> <td>Secondo Campo</td> <td>Campo X</td> <% for j=0 to TOT_C %> <td>Caratteristica <%= j+1 %></td> <%next%> </tr> <% i=0 rs.movefirst while not rs.eof %> <tr> <td><%= rs("campo1")%></td> <td><%= rs("campo2")%></td> <td><%= rs("campoX")%></td> <% for j=0 to TOT_C %> <td><%=arrayRs(i,j)%></td> <%next%> </tr> <% i=i+1 rs.movenext wend %> </table> <% end if %>

Rispondi quotando