Question RE ASP code generated by Access

aahmed

Newcomer
Joined
Aug 11, 2003
Messages
3
Greetings All,

I have the following ASP code generated by MS Access, the code displays a table that can be viewed via a web browser. Currently the code displays the first record first and the last record last, is there a way to switch it so that it displays the last record first and the first record last?

Here's the code:


<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=windows-1252">
<TITLE>PHSWEB</TITLE>
</HEAD>
<BODY>
<%
If IsObject(Session("PHSWEB_conn")) Then
Set conn = Session("PHSWEB_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PHSWEB","",""
Set Session("PHSWEB_conn") = conn
End If
%>
<%
If IsObject(Session("Messages_rs")) Then
Set rs = Session("Messages_rs")
Else
sql = "SELECT * FROM [Messages]"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 3, 3
If rs.eof Then
rs.AddNew
End If
Set Session("Messages_rs") = rs
End If
%>

<%

On Error Resume Next
rs.Movefirst
do while Not rs.eof
%>


<TABLE WIDTH=400 BORDER=1 BORDERCOLOR=BLACK CELLPADDING=3 CELLSPACING=0>
<TD BGCOLOR=#CCCCCC><FONT FACE=ARIAL SIZE=1>Posted by <%=Server.HTMLEncode(rs.Fields("Posted By").Value)%> at <%=Server.HTMLEncode(rs.Fields("Time of Post").Value)%></TD>
<TR>
<TD><FONT FACE=ARIAL SIZE=2><%=Server.HTMLEncode(rs.Fields("Message").Value)%><BR></FONT></TD>
</TABLE>
<BR>



<%
rs.Movenext
loop%>

</BODY>
</HTML> <HTML>
 
Wow, is this .NET?
Anyhow, try putting a sort order to the SQL...

Visual Basic:
sql = "SELECT * FROM [Messages] ORDER BY SomeColumn DESC"
 
Back
Top