How can I modify the following code so that I can display the records in a reverse order?
Code:
<!--#include file="../inc/initialize.asp"--><%
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRs = Server.CreateObject("ADODB.Recordset")
entryid = request.QueryString("entryid")
if not(isnumeric(entryid)) then
entryid = 0
end if
strKeyListing = "listing_" & siteID & "_" & pageID & "_" & langID
strKeyEntry = "entry_" & siteID & "_" & pageID & "_" & langID
listingpage = getFromCache(strKeyListing)
entrypage = getFromCache(strKeyEntry)
if listingpage & "" = "" or entrypage & "" = "" then
SQL = "SELECT listingpage, entrypage FROM " & TABLE_PREFIX & "TableDetails INNER JOIN CCM_Templates ON " & TABLE_PREFIX & "TableDetails.display = CCM_Templates.ID WHERE TablePageID = " & tablePageID & " AND langID=" & LangID
oConn.Open Application("ConStr")
oRs.Open SQL, oConn, 3, 1, 1
if Not oRs.EOF Then
listingpage = oRs("listingpage")
entrypage = oRs("entrypage")
putToCache strKeyListing, listingpage
putToCache strKeyEntry, entrypage
end if
oRs.close
oConn.close
end if
set oRs = nothing
set oConn = nothing
If listingpage & "" <> "" then
if entryid <> 0 and entrypage & "" <> "" then
server.Execute "includes/" & entrypage
else
server.Execute "includes/" & listingpage
end if
else
server.Execute "tags/PageContent.asp"
end if
%>
I have put " ORDER BY <FieldName> DESC" at the end of the SQL, but it didn't work, why???
Code:
<!--#include file="../inc/initialize.asp"--><%
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRs = Server.CreateObject("ADODB.Recordset")
entryid = request.QueryString("entryid")
if not(isnumeric(entryid)) then
entryid = 0
end if
strKeyListing = "listing_" & siteID & "_" & pageID & "_" & langID
strKeyEntry = "entry_" & siteID & "_" & pageID & "_" & langID
listingpage = getFromCache(strKeyListing)
entrypage = getFromCache(strKeyEntry)
if listingpage & "" = "" or entrypage & "" = "" then
SQL = "SELECT listingpage, entrypage FROM " & TABLE_PREFIX & "TableDetails INNER JOIN CCM_Templates ON " & TABLE_PREFIX & "TableDetails.display = CCM_Templates.ID WHERE TablePageID = " & tablePageID & " AND langID=" & LangID
oConn.Open Application("ConStr")
oRs.Open SQL, oConn, 3, 1, 1
if Not oRs.EOF Then
listingpage = oRs("listingpage")
entrypage = oRs("entrypage")
putToCache strKeyListing, listingpage
putToCache strKeyEntry, entrypage
end if
oRs.close
oConn.close
end if
set oRs = nothing
set oConn = nothing
If listingpage & "" <> "" then
if entryid <> 0 and entrypage & "" <> "" then
server.Execute "includes/" & entrypage
else
server.Execute "includes/" & listingpage
end if
else
server.Execute "tags/PageContent.asp"
end if
%>
I have put " ORDER BY <FieldName> DESC" at the end of the SQL, but it didn't work, why???