in asp mi faccio questo ciclo che mi dice i compleanni da 2 giorni indietro ai due giorni futuri
la tabella č composta dai campi
id contatore
cognome testo
nome testo
datanascita data
codice:
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open dbconnstr
for i=-2 to 2 %>
<TABLE WIDTH=300 BORDER=1 ALIGN=CENTER>
<% if i=0 then %>
<TR CLASS=today>
<% else %>
<TR CLASS=titoletto>
<%end if
newdata=DateAdd("d",i,date)
%>
<TD><%=newdata%>: compleanno di</TD>
</TR>
<%
Set rst = Server.CreateObject("ADODB.Recordset")
giorno=day(newdata)
mese=month(newdata)
sqlstring="SELECT * from compleanni where datepart(" & chr(34) & "d" & chr(34) & ",[datanascita])=" & giorno & " AND datepart(" & chr(34) & "m" & chr(34) & ",[datanascita])=" & mese
rst.open sqlstring ,conn,3,3
if not rst.eof then
do while not rst.eof
%>
<TR>
<TD><%=rst("nome")%><%=rst("cognome")%></TD>
</TR>
<%
rst.movenext
loop
response.write "</TABLE>"
else%>
<TD>Nessuno</TD>
<%end if
rst.close
set rst=nothing
next
conn.close
set conn = nothing
%>