Ciao a tutti.
Ho la necessità di pubblicare degli annunci una bacheca che durino al massimo 3 mesi dalla data di inserimento.
Nella tabella "INSERZIONI" ho inserito "DATA_FINE" (data di inserimento più tre mesi).
Nonostante la condizione (DATA_FINE >= " & oggi & ") continuo però a visualizzare tutte le inserzioni...![]()
Ecco il codice
grazie per l'aiutocodice:<% Dim objConn, strConn, objRs, strsql, oggi oggi = Date() If Session("login") then strConn = Application("dbconn") strsql = "Select * from INSERZIONI where (ID1= " & id1 & ") and (DATA_FINE >= " & oggi & ") order by DATA, ORA" Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open strConn Set objRs = Server.CreateObject("ADODB.Recordset") objRs.CursorLocation = adUseClient set objRs = objConn.Execute(strsql) response.write "<div align=center>" response.write "<table border='1' width='80%' cellpadding='4' cellspacing='4' bgcolor='bisque'>" response.write "<tr><th colspan='5' align='center'><font size='+2' color='firebrick'>LE TUE INSERZIONI</font></th</tr>" Do while Not objRs.EOF %> <tr> <td width="15%"><font color='teal'><%= objRs("COD") %></font></td> <td width="15%"><font color='teal'><%= objRs("DATA") %></font></td> <td width="50%"><font color='teal'><%= objRs("OGGETTO") %></font></td> <td width="10%">">cambia</td> <td width="10%">&FOTO=<%=objRs("FOTO")%>">cancella</td> </tr> <% objRs.MoveNext Loop Response.write "</table></div>" Response.write(Date()) end if end if %>

Rispondi quotando
