slt les camarades
j'ai une fct qui fait ce travail(tableau croisé en sql)
function WriteTabCroise(sSQL, Titre)
'Génére automatiquement des tableaux croisés en fonction de la requête SQL
' sSQL = Requete SQL
' Titre = Titre du tableau
Set Connection = Server.CreateObject("ADODB.Connection")
Set RecordSet = Server.CreateObject("ADODB.RecordSet")
Connection.connectionString = DBPath
Connection.Open
if Titre <> "" then
Response.write "<BR><B><Center>" & Titre & "</Center></B><BR>" & vbcrlf
End If
RecordSet.Open sSQL, Connection, 3, 3
if RecordSet.EOF = false then
Response.write "<Table border=1 bordercolor=green cellspacing=0 cellspading=0 width='100%'>"
Response.write "<TR align=center bgcolor=green>" & vbcrlf
'Création des collones
for each rsfield in recordset.Fields
Response.write "<TD><B><font color=yellow>" & rsfield.Name & "</font></B></TD>" & vbcrlf
next
Response.write "</TR>" & vbcrlf
'Affichage de chaque ligne
Do while not RecordSet.EOF
Response.write "<TR>" & vbcrlf
i = 0
For each RecordSetItem in RecordSet.Fields
i = i + 1
if i=1 then
Response.write "<TD align=left nowrap>" & vbcrlf
else
Response.write "<TD align=center>" & vbcrlf
end if
if isnull(RecordSetItem) = true then
Texte = "-"
else
Texte = RecordSetItem
if isnumeric(RecordSetItem) = true then
if RecordSetItem <> 0 then
Texte = "<Font Color=red><B>" & Texte & "</B></font>" & vbcrlf
end if
else
Texte = "<Font Color=green><B>" & Texte & "</B></font>" & vbcrlf
end if
end if
Response.write Texte
Response.write "</TD>" & vbcrlf
next
Response.write "</TR>" & vbcrlf
RecordSet.MoveNext
Loop
Response.write "</TABLE><BR>" & vbcrlf
end if
RecordSet.Close
Connection.Close
Set Connection = nothing
Set RecordSet = nothing
End function