si, unico accorgimento:
codice:num=rec.recordcount num = Cint(num / 2)' per evitare le virgole nel caso sia dispari (se 11/2, viene 5.5 e devi arrotondare)
si, unico accorgimento:
codice:num=rec.recordcount num = Cint(num / 2)' per evitare le virgole nel caso sia dispari (se 11/2, viene 5.5 e devi arrotondare)
anzi per essere + precisi
codice:num = rec.recordCount if (num mod 2) <> 0 then num = Round(num/2)+ 1 else num = (num/2)
..................anzi per essere + precisi
code:--------------------------------------------------------------------------------
num = rec.recordCount
if (num mod 2) <> 0 then num = Round(num/2)+ 1 else num = (num/2)------------------------------------------------------------------------
..................
End if
lo provo così.
Ros.
in via finale:
codice:<table> <tr> <td width="50%" align="left" valign="top"> <%counter=0 SQL="SELECT * FROM Lines order by Description" Set rec = Server.CreateObject("ADODB.Recordset") rec.open sql, Webstore, 3 , 3 num=rec.recordcount if (num mod 2) <> 0 then num = Round(num/2)+ 1 else num = (num/2) do While Not rec.EOF if counter<=num then counter=counter+1 %> " title="Categoria <%=rec("Catname")%>"><%=rec("Description")%> <% else %> </td> <%counter= 0 %> <td width="50%" align="left" valign="top"> " title="Categoria <%=rec("Catname")%>"><%=rec("Description")%> <%end if rec.movenext loop%> </td> <% rec.close set rec = Nothing %> </tr> </table>
Ok perfetto. Ho giusto 29 record, e l'esempio calza alla perfezione.
Mi suddivide la prima tabella in 16 elementi, mentre la seconda in 13.
Ripeto lo script perchè manca un "End If ":
Per il resto è un'ottimo lavoro.codice:<table> <tr> <td width="50%" align="left" valign="top"> <%counter=0 SQL="SELECT * FROM Lines order by Description" Set rec = Server.CreateObject("ADODB.Recordset") rec.open sql, Webstore, 3 , 3 num=rec.recordcount if (num mod 2) <> 0 then num = Round(num/2)+ 1 else num = (num/2) End if do While Not rec.EOF if counter<=num then counter=counter+1 %> " title="Categoria <%=rec("Catname")%>"><%=rec("Description")%> <% else %> </td> <%counter= 0 %> <td width="50%" align="left" valign="top"> " title="Categoria <%=rec("Catname")%>"><%=rec("Description")%> <%end if rec.movenext loop%> </td> <% rec.close set rec = Nothing %> </tr> </table>
Mi auguro che l'esempio serva a molti.
Ancora un grazie.![]()
![]()
Ros.
oks, cmq l'End if non ci va
se l'operazione è tutta su una riga non serve l'end if
es:
if member > 35 then
JohnHolmes = true
else
JohnHolmes = false
end if
puo' tranquillamente essere scritto
if member > 35 then JohnHolmes = true else JohnHolmes = false