con questo codice il risultato è giusto ma mi da un'errore:
set rs = server.CreateObject("ADODB.Recordset")
rs.open "SELECT offercat, MAX(id) FROM mercatino GROUP BY offercat ORDER BY 2 DESC ", Conn
response.Write sql
' inizio tabella
response.Write"<div align='center'><table border='0' cellspacing='0' cellpadding='0'bordercolor='#000000' ><tr>"
max=2
do while not rs.EOF
sql = "SELECT * FROM mercatino WHERE (offercat = '"& rs("offercat") &"') AND immagine<>'' ORDER BY id DESC"
set rsCat = conn.execute(sql)
if rsCat("immagine")<> "" then
x=x+1
'titolo messaggio
titolo = rsCat("offercat")
if x<9 then
response.Write"<td width='15px'></td><td><table width='100%'
border='1px' cellspacing='0' cellpadding='0'
bordercolor='#990000'><tr border='0'><td border='0'><a
href=offerlistcat.asp?selectcat=" & titolo &"><img height='89'
width='158' src=../../dati/public/mercatino/"&rsCat("IMMAGINE")&"
border='0'></td> </tr><tr><td bgcolor='#FAD145'><div
align='center'><a href=offerlistcat.asp?selectcat=" & titolo
&"><font size='2' color='#000000'>" & rsCat("offernome")
&"</font></a></div></td></tr></table>
</td><td width='10px'></td>"
if x=max then
max=max+2
response.Write"<tr></tr>"
end if
end if
end if
set rsCat = nothing
rs.movenext
loop
response.Write"</tr></table></div>"
rs.close()
set rs = nothing
conn.close
set conn = nothing
e l'errore è:
error '80020009'
Exception occurred

Rispondi quotando