Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    please help with "order by" in ASP

    I have this:
    SELECT * from truyen_truyenngan, truyen_titles, truyen_authors where truyen_titles.ID = truyen_truyenngan.title_ID and truyen_authors.ID=truyen_titles.title_authors and truyen_titles.ID =" & ID, truyen_GetDatabaseConn, 1,3

    how do i add "order by" into that statement? please help

    for example if i want to add "order by date desc" , please let me know how to insert this into the statement above.

    thnks

  • #2
    New Coder
    Join Date
    Aug 2005
    Location
    Laguna, Philippines
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by billykiet
    I have this:
    SELECT * from truyen_truyenngan, truyen_titles, truyen_authors where truyen_titles.ID = truyen_truyenngan.title_ID and truyen_authors.ID=truyen_titles.title_authors and truyen_titles.ID =" & ID, truyen_GetDatabaseConn, 1,3

    how do i add "order by" into that statement? please help

    for example if i want to add "order by date desc" , please let me know how to insert this into the statement above.

    thnks
    im using recordset, so if you want, you could try
    set rs = server.createobject("ADODB.Recordset")
    sql = "SELECT * from truyen_truyenngan, truyen_titles, truyen_authors where truyen_titles.ID = truyen_truyenngan.title_ID and truyen_authors.ID=truyen_titles.title_authors and truyen_titles.ID =" & ID & " order by truyen_truyenngan.date desc"

    rs.cursortype = 1
    rs.locktype = 3
    rs.open truyen_GetDatabaseConn
    "It is the unknown we fear when we look upon death and darkness, nothing more!"-- Albus Dumbledore

  • #3
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is the error i got after what you've showed me:

    ADODB.Recordset error '800a0e7d'

    The connection cannot be used to perform this operation. It is either closed or invalid in this context.

  • #4
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #5
    New to the CF scene
    Join Date
    Mar 2006
    Location
    shanghai,CHN
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sql="SELECT * from truyen_truyenngan, truyen_titles, truyen_authors where truyen_titles.ID = truyen_truyenngan.title_ID and truyen_authors.ID=truyen_titles.title_authors and truyen_titles.ID = " & ID & " order by date desc"

    set rs=truyen_GetDatabaseConn.execute(sql)

  • #6
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Code:
    "SELECT * from truyen_truyenngan, truyen_titles, truyen_authors where truyen_titles.ID = truyen_truyenngan.title_ID and truyen_authors.ID=truyen_titles.title_authors and truyen_titles.ID =" & ID & " ORDER BY truyen_authors", truyen_GetDatabaseConn, 1,3


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •