3.122 messaggi dal 16 maggio 2002
Mah.. secondo me non c'è bisogno di eseguire numero_categorie+1 query :)

The day Microsoft makes something that doesn't suck
is probably the day they start making vacuum cleaners.

Get caught!
Get caught again!
38 messaggi dal 08 ottobre 2003
Raynor ha scritto:
Mah.. secondo me non c'è bisogno di eseguire numero_categorie+1 query :)


non è qui:
numCat = Ubound(arrdati,2)+1
che accade ciò che tu dici?
3.122 messaggi dal 16 maggio 2002
Intendevo che con quello script devi fare 1 query per avere l'elenco delle categorie + 1 query per ogni categoria. Totale query = numero_categorie+1 :)

Se invece fai quella che ti ho detto io e poi controlli quando la categoria cambia sei a posto. Ho usato spesso questo sistema e ti assicuro che funziona perfettamente.

The day Microsoft makes something that doesn't suck
is probably the day they start making vacuum cleaners.

Get caught!
Get caught again!
38 messaggi dal 08 ottobre 2003
Ti ringrazio tantissimo per le delucidazioni ma sinceramente non so dove mettere le mani "I'm the PIVEL"
38 messaggi dal 08 ottobre 2003
Per concludere io smanetta smanetta ho risolto in questo modo e metto il codice funzionante a disposizione della comunità e concludo ringraziando tutti per il prezioso aiuto.
Anche se il codice di "vitosulla" mi piacerebbe vederlo funzionare.

Mio codice funzionante:

<%
Set cn=Server.CreateObject("ADODB.Connection")
cn.Open = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("news.mdb")
Set rs=Server.CreateObject("ADODB.Recordset")
strSQL="SELECT notizia, pagina, categoria FROM newslinks order by categoria"
rs.Open strSQL,cn,0,1
arrdati=rs.getrows()
rs.close
set rs=nothing
cn.close
set cn=nothing
cat = ""
response.write "<table><tr><td>"
for conta=0 to ubound(arrdati,2)
field = arrdati(2,conta)
if cat <> field then
response.write field
cat = field
response.write "<br>"
end if
response.write "<class='titoloarancio'><a href=""" & arrdati(1,conta) & """ target='_blank' class='lbianco'>" & arrdati(0,conta) & "</a>"
if ((conta+1) mod 6)=0 then
response.write "</td><td>"
else
response.write "<br>"
end if
next
response.write "</td></tr></table>"
erase arrdati
%>
593 messaggi dal 09 ottobre 2002
www.dotnetside.org


E' che nella fretta ho trascurato di valorizzare la variabile "conta" che dovrebbe fungere da una sorta di contatore.

Se provi sostituire il codice cha va dal primo FOR all'ultimo NEXT con questo:
indice = 1
for i = 1 to numRighe 
Response.Write "<tr>" 
for conta=1 to numCols 
if indice <= numCat
response.write "<td><table>" 
response.write "<tr><th><%=arrdati(0,indice-1)%> </th></tr>" 
strSQL="SELECT notizia, pagina FROM newslinks WHERE categoria = '" & arrdati(0,indice-1) & "';" 
rs.open strSQL, cn 
while not rs.eof 
Response.write "<tr><td><a href='" & rs("pagina") &"'>" & rs("notizia") & "</a></td></tr>" 
wend 
rs.close 
else 
response.write "<tr><th>&nbsp;</th></tr>" 
response.write "<tr><td>&nbsp;</td></tr>" 
end if 
Response.Write "</table></td>" 
indice = indice+1
next 
Response.Write "</tr>"
indice = indice + 1
next 


In realtà ho semplicemente aggiunto un contatore (indice) che tiene conto del numero delle celle riempite.

Ciao

Pochi post. Anzi, quasi quasi spengo
http://www.dotnetside.org/
38 messaggi dal 08 ottobre 2003
codice modificato:

<%response.buffer=true%>inserito da me causa errore
<%
Set cn=Server.CreateObject("ADODB.Connection")
cn.Open = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("news.mdb")
Set rs=Server.CreateObject("ADODB.Recordset")
strSQL="SELECT categoria FROM newslinks order by categoria"
rs.Open strSQL,cn,0,1
if not rs.eof then
arrdati=rs.getrows()
rs.close
numCat = Ubound(arrdati,2)+1
numCols = 4 'numero di colonne su cui ripartire le categorie
numRighe = Cint(numCat/numCols + 0.5)
response.write "<table>"
indice = 1
for i = 1 to numRighe
Response.Write "<tr>"
for conta=1 to numCols
if indice <= numCat Then
response.write "<td><table>"
response.write "<tr><th>" & arrdati(0,indice-1) & "</th></tr>"
strSQL="SELECT notizia, pagina FROM newslinks WHERE categoria = '" & arrdati(0,indice-1) & "';"
rs.open strSQL, cn
while not rs.eof
Response.write "<tr><td><a href='" & rs("pagina") &"'>" & rs("notizia") & "</a></td></tr>"
wend
rs.close
else
response.write "<tr><th>&nbsp;</th></tr>"
response.write "<tr><td>&nbsp;</td></tr>"
end if
Response.Write "</table></td>"
indice = indice+1
next
Response.Write "</tr>"
indice = indice + 1
next
response.write "</table>"
erase arrdati
else
Response.Write "non ci sono categorie inserite"
rs.close
end if
set rs=nothing
cn.close
set cn=nothing
%>

ma l'errore persiste:

Response object error 'ASP 0251 : 80004005'

Response Buffer Limit Exceeded

/incolonna.asp, line 0

Execution of the ASP page caused the Response Buffer to exceed its configured limit.

Modificato da grafichero il 11 novembre 2005 13.13 -
593 messaggi dal 09 ottobre 2002
www.dotnetside.org
 Mea culpa

L'errore riguarda il buffering del recordset.

Se fai caso al ciclo

WHILE not rs.eof
....
WEND

ho trascurato l'istruzione di avanzamento del recordset

Prima di WEND aggiungi:

rs.MoveNext

Scusa ancora....la fretta

Pochi post. Anzi, quasi quasi spengo
http://www.dotnetside.org/

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.