Ciao Ragazzi,
ho una pagina asp che fa una richiesta ad un DB e mi restituisce i dati dandomi la prossima data che arriverà in base alla data odierna e poi me li ordina in modo ASC.
Ora la domandona è....perché mi ordina le date in modo sballato???
Il link per vedere il listato è questo:
http://212.147.30.69/corsi_all.asp
Se osservate le date del 8.11.2010 e 9.11.2010 non sono al loro posto!
Ecco il codice che ho usato nella pagina:
<html>
<head>
<title>Cc-Ti >> archivio corsi</title>
<LINK href="css/styles.css" type=text/css rel=stylesheet>
</head>
<META http-equiv=Content-Language content=it>
<META http-equiv=content-type content="text/html; charset=ISO-8859-1">
<body>
<h1>[img]img/archivio_corsi.png[/img]</h1>
<%
Set Conn=Server.CreateObject("ADODB.Connection")
strConn="driver={Microsoft Access Driver (*.mdb)}; "
strConn=strConn & " DBQ=" & Server.MapPath("db/news.mdb")
Conn.Open strConn
oggi = year(date()) &"-"& right("0"& month(date()),2) &"-"& right("0"& day(date()),2)
sql = "SELECT * FROM tbCorsi WHERE tbCorsi.Data >= '"& oggi &"' ORDER BY tbCorsi.Data ASC"
Set rs = Server.CreateObject("ADODB.Recordset")
Set rs.ActiveConnection = conn
rs.Source = "tbCorsi"
rs.Open sql, conn
If rs.EOF Then
%>
Nessun record trovato!</p>
<%
Else
While rs.EOF = False
%>
<%
data = day(rs("Data")) &"."& month(rs("Data")) &"."& year(rs("Data"))
%>
<%=data%>
<%=rs("Titolo")%>[b]
<%=rs("Link")%></p>
<%
rs.MoveNext
Wend
End If
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
%>
</body>
</html>
Grazie mille!

Rispondi quotando