no, ord non è vuota,sono io che ho messo solo una parte di codice...ora lo posto tutto:
codice:
<td width="15%" bgcolor="#F8663D" align="center" height="12">
<font face="Verdana" size="1" color="#FFFFFF"><a href="list-news.asp?order=tit">
<font color="#FFFFFF">Titolo</font></a></font></td>
<td width="40%" bgcolor="#F8663D" align="center" height="12">
<font face="Verdana" size="1" color="#FFFFFF"><a href="list-news.asp?order=ogg">
<font color="#FFFFFF">Contenuto</font></a></font></td>
<td width="10%" bgcolor="#F8663D" align="center">
<font face="Verdana" size="1" color="#FFFFFF"><a href="list-news.asp?order=data">
<font color="#FFFFFF">Data</font></a></font></td>
<td width="7%" bgcolor="#F8663D" align="center" height="12">
<font face="Verdana" size="1" color="#FFFFFF">Modifica</font></td>
<td width="7%" bgcolor="#F8663D" align="center" height="12">
<font face="Verdana" size="1" color="#FFFFFF">Elimina</font></td>
</tr>
<%
SQL="SELECT * from news order by data desc, id desc"
rs.Open sql, conn, 1, 3
do while not rs.EOF
i = i + 1
rs.movenext
loop
if i = 0 then
Response.Write("Nessun dato disponibile")
else
ord = Request.Querystring("order")
if ord = "tit" then
ord = "Titolo"
end if
if ord = "ogg" then
ord = "Oggetto"
end if
if ord = "data" then
ord = "Data desc"
End IF
Dim Page_Size
Dim Current_Page
Dim Page_Count
Page_Size = 4
If Request("Page") = "" Then
Current_Page = 1
Else
Current_Page = CInt(Request("Page"))
End If
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.CursorLocation = adUseClient
rs.PageSize = Page_Size
SQL="SELECT * From news order by "&ord&" "
rs.Open SQL, conn
Page_Count = rs.PageCount
If 1 > Current_Page Then Current_Page = 1
If Current_Page > Page_Count Then Current_Page = Page_Count
rs.AbsolutePage = Current_Page
Do While rs.AbsolutePage = Current_Page And Not rs.EOF
'inizializzazione del recordset
titolo=rs("Titolo")
oggetto=rs("Oggetto")
data=rs("Data")
gg = Day(data)
mm = Month(data)
aaaa = Year(data)
data_n = DateSerial(Year(data), Month(data), Day(data))
%>
<tr>
<td width="15%" bgcolor="#DADADA" height="13">
<%Response.Write(titolo)%><font face="Verdana" size="1" color="#716F6E"> </font>
</td>
<td width="40%" bgcolor="#DADADA" height="13">
<%Response.Write(oggetto)%><font face="Verdana" size="1" color="#716F6E"> </font>
</td>
<td width="10%" bgcolor="#DADADA" align="center">
<%Response.Write(data_n)%><font face="Verdana" size="1" color="#716F6E"> </font>
</td>
<td width="7%" bgcolor="#DADADA" height="13">
<p align="center"><a href="edit.asp?id=<%=rs("id")%>">
<font color="#716F6E" face="Verdana" size="1">[img]modifica.gif[/img]</font></td>
<td width="7%" bgcolor="#DADADA" height="13">
<p align="center"><a href="delete.asp?id=<%=rs("id")%>">
<font color="#716F6E" face="Verdana" size="1">[img]cancella.gif[/img]</font></td>
</tr>
<%
rs.movenext
loop
end if
rs.close
set rs = nothing
Response.Write "<center>"
Response.Write "<td colspan=""10"" align=""center"">
"
If Current_Page = 1 Then
Response.Write "<font color='#000000'>Inizio | "
End If
If Current_Page >= 2 Then
Response.Write "<< Inizio | " & vbCrLf
End If
If Current_Page >= Page_Count Then
Response.Write "<font color='#000000'>Successiva >|"
End If
If Current_Page < Page_Count Then
Response.Write "Successiva >" & "|" & vbCrLf
End IF
If Current_Page <> 1 Then
Response.Write "< Precedente | " & vbCrLf
Response.Write " " & vbCrLf
End If
If Current_Page = 1 Then
Response.Write "<font color='#000000'>< Precedente | "
End If
If Current_Page <> Page_Count Then
Response.Write "Ultima >>" & vbCrLf
End If
If Current_Page >= Page_Count Then
Response.Write "Ultima"
End If
%>
questo è quanto.l'errore che continua a darmi è che c'è un errore di sintassi nella riga
codice:
SQL="SELECT * From news order by "&ord&" "
ord è una variabile per ordinare i record di una tabella in base a Titolo, Contenuto e Data.