Ciao ragazzi,
vi propongo un nuovo quesito ( premetto che l'asp lo stō imparando):
Sto realizzando una gestione news, e l'ho fatta in maniera abbastanza buona.
Il problema č quando le visualizzo in home page. Vorrei che se inserisco delle news con data prossima ( futura ) non venga visualizzato fino a quando no arriva quel giorno... ma non vā... dove sbaglio?
vi posto il codice:
La stringa sql mi porta questo:codice:<% 'paginazione RecordsPerPagina = 6 page = Request("page") if page="" then page=1 orderby = Request.QueryString("orderby") dataattuale = Day(Date()) & "/" & Month(Date()) & "/" & Year(Date()) If orderby = "" then orderby = "data DESC" if orderby = "data" then orderby = "data DESC" end if Conn.Open strConn sql = "SELECT * FROM tbl_news WHERE data <= " & dataattuale & " order by " & orderby Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, conn ,3,3 %> <table width="95%" align="center"> </table> <% rs.PageSize = RecordsPerPagina rs.AbsolutePage = page <--------------- riga 25 If rs.Eof=True or rs.Bof=True then Response.Write " Nessun risultato trovato</P>" Else %> <table width="95%" align="center"> <tr> <td width="50%" bgcolor="#FFFFFF">Ordina per: titolo - <a href=default.asp?page=1&orderby=autore>autore</a></td> <td width="50%" bgcolor="#FFFFFF"> <div align="right"> <% Response.Write " Pagine: " For pag=1 to rs.PageCount Response.Write "<A href='guest.asp?page=" & pag & "&order?=" & orderby Response.write "'>" Response.Write pag Response.Write "</A> " Next Response.Write "</P>" %> </div></td> </tr> </table> <% rs.PageSize = RecordsPerPagina rs.AbsolutePage = page If rs.Eof=True or rs.Bof=True then Response.Write " Nessun risultato trovato</P>" Else For i=1 to RecordsPerPagina if Not rs.EOF then %> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" style="border: 1px solid #11283E"> <tr> <td width="30">[img]../image/05b.gif[/img]</td> <td width="100%" background="../image/06.gif"><div align="center"><font size="5"><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><%=rs(2)%></font></font></div></td> <td width="30">[img]../image/05.gif[/img]</td> </tr> </table> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" style="border: 1px solid #11283E"> <tr> <td width="95%" background="../image/07.gif" height="15">[img]../image/07.gif[/img] </td> </tr> <tr> <td height="105" valign="top" bgcolor="FFFFFF"><div align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100" valign="top"> <%if rs(5) <> "" then%> [img]<%=rs(5)%>[/img] <% else %><% end if %> </td> <td width="598"><font size="2"><%=rs(3)%></font> <%Response.Write Left(rs("corpo"), 200)%> <a href="../dettaglio_news.asp?id=<%=rs(0)%>">...(leggi tutto / read news) </a> </td> </tr> </table> </div></td> </tr> <tr> <td background="../image/08.gif">[img]../image/08.gif[/img]Autore: <%=rs(4)%> Data: <%=rs(1)%></td> </tr> <tr> <td height="19" background="../image/headerbg.gif"></td> </tr> </table> <% rs.MoveNext end if Next End if end if rs.Close set rs = Nothing conn.Close set conn = Nothing %>
SELECT * FROM tbl_news WHERE data <= 11/10/2006 order by data DESC
L'errore che mi dā č questo:
Attualmente nel database per prova ho inserito 3 news con date diverse ( 2 prima e 1 dopo la data di oggi ) ma rimane l'errore.codice:ADODB.Recordset error '800a0bcd' Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. /includes/inc_display_news.asp, line 25
sapete aiutarmi?

):
<% end if %>
</td>
<td width="598"><font size="2"><%=rs(3)%></font>
<%Response.Write Left(rs("corpo"), 200)%>
<a href="../dettaglio_news.asp?id=<%=rs(0)%>">...(leggi tutto / read news)
</a>
</td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td background="../image/08.gif">[img]../image/08.gif[/img]Autore: <%=rs(4)%> Data: <%=rs(1)%></td>
</tr>
<tr>
<td height="19" background="../image/headerbg.gif"></td>
</tr>
</table>
<%
rs.MoveNext
end if
Next
End if
end if
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
%>
Rispondi quotando
