p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Ascending Order


Message #1 by "Bill Sisemore" <bsisemore@m...> on Sun, 17 Sep 2000 18:49:27 -0400
Thank you.  This was the one that fixed it!  Excellent!

-----Original Message-----
From: Imar Spaanjaars <Imar@S...>
To: "Code Clinic" <proasp_codeclinic@p...>
Date: Mon, 18 Sep 2000 08:59:53 +0200
Subject: [proasp_codeclinic] Re: Ascending Order

> Add the ORDER BY command to you SQL statement. How this command looks 
> depends on which column you want to sort.
> If you have an autonumber field in your table, use that, otherwise I
> guess 
> there must be a table containing the date or something.
> Modify your SQL statement to something like this:
> 
> sSQL = "SELECT * FROM Table1 WHERE email='" & stremail & "' ORDER BY 
> yourColumnName DESC"
> 
> This will sort the recordset based on yourColumnName in reversed order 
> (i.e. if it is a autonumber, the highest number first).
> 
> If you want to sort ascending, replace DESC with ASC, or leave it out 
> completely since ASC is the default.
> 
> HtH.
> 
> Imar
> 
> 
> 
> At 08:04 AM 9/18/2000 -0700, you wrote:
> >Ladies & Gentlemen,
> >
> >Below you will find the code I am using to display (based on email
> >address,) user service requests for support.  This code lists the
> >obvious, but I want it to be returned to the user with the latest
> >incident at the top of the list.
> >
> >If you have the time, please respond.  Thanks in advance.
> >
> >Bill Sisemore
> >
> ><%
> >
> >strSpace = strSpace & " | "
> >stremail = cStr(Request.Form("txtemail"))
> >
> >Set objConn = Server.CreateObject("ADODB.Connection")
> >Set objRS = Server.CreateObject("ADODB.Recordset")
> >
> >objConn.Open "helpdesk"
> >
> >sSQL = "SELECT * FROM Table1 WHERE email='" & stremail & "'"
> >
> >
> >Set objRS = objConn.Execute(sSQL)
> >
> >
> >Do While NOT objRS.EOF
> >
> >         Response.Write objRS("index") & strSpace
> >         Response.Write objRS("location") & strSpace
> >         Response.Write objRS("date") & strSpace
> >         Response.Write objRS("issue") & strSpace
> >         Response.Write objRS("description") & "<BR><BR>"
> >
> >         objRS.MoveNext
> >
> >Loop
> >
> >objRS.Close
> >Set objRS = Nothing
> >
> >objConn.Close
> >Set objConn = Nothing
> >
> >%>
> >
> >

  Return to Index