Query Question

  • I have an SQL Server 2000 running a website, I have an Admin page that I use to manage documents.  This admin page displays the documents in DESC order by default based on Release date, I would like to change this to put the most recent document at the top, or ASC I believe.  I can't tell where the display is ordered though? Any Help appreciated. 

     

    Here is the query code:

    dim rsRecords

    dim strDisplayQuery

    set rsRecords=server.CreateObject ("ADODB.RecordSet")

    strDisplayQuery="select DocumentID,Title,ReleaseDate,Disable from tblDocument where DocumentTypeCode=" & rv

    strDisplayQuery=strDisplayQuery & "Order by ReleaseDate"

    set rsRecords= GetRecords(strDisplayQuery)

  • strDisplayQuery="select DocumentID,Title,ReleaseDate,Disable from tblDocument where DocumentTypeCode = " & rv & " Order by ReleaseDate DESC"

  • use Remi's code.

    DESC order is what you want. That will make the latest entry display first.

    ASC is the default sort order, which is what you were getting before.


    Julian Kuiters
    juliankuiters.id.au

  • Ok Thank you all for all your help, but I am pretty new at this, and apparently there is something out of sinc here...adding DESC at that point in the code doesn't help and i will explain.

    I loginto an admin page that manages documents...I choose a document type from a drop down list, and the page refreshes...so adding the code to the spot we did up top, doesnt do anything to the list after it is returned?  Does that make sense?  I can post as much code as necessary, I am just not sure what you might need to diagnose? I have a few functions at the top of the page, which may be needed.

    function submitter()

    {

    val=document.forms[0].cmbDocumentTypes.options[document.forms[0].cmbDocumentTypes.selectedIndex].value;

    if(val!=-9999)

    {

    document.forms[0].action="Documents.asp"

    document.forms[0].submit()

    }

    }

     

     

    OK, I left this here just so you could follow my thought process, but WOOHOO it did work, after directing the function to my test page, DAH, "Documents2.asp" works just fine thank you! Thank You.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply