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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    little error in code 'Expected end of statement'

    hi this code:

    dim ordervariable, sortorder
    ordervariable = "Category" 'default column to sort on
    sortorder = "ASC" 'default sortorder

    if (len(request.querystring("sortby")) >= 1) then
    ordervariable = request.querystring("sortby")
    end if
    if (len(request.querystring("sortorder")) >= 1) then
    sortorder = request.querystring("sortorder")
    end if

    strSQL = "SELECT Name, Category, County, Town, ID " _
    & "FROM NETWORK " _
    & "WHERE Status=1 LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    & "OR Name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    & "OR Category LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    & "ORDER BY & ordervariable & " " & sortorder " _


    gives me this error

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /business/network.asp, line 137

    & "ORDER BY & ordervariable & " " & sortorder " _
    --------------------------------^

    any ideas?

    thanks

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    London, UK
    Posts
    411
    Thanks
    0
    Thanked 1 Time in 1 Post
    Wrong:
    Code:
    & "ORDER BY & ordervariable & " " & sortorder " _
    Right:
    Code:
    & "ORDER BY " & ordervariable & " " & sortorder " _
    Marcus Tucker / www / blog
    Web Analyst Programmer / Voted SPF "ASP Guru"

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks!


  •  

    Posting Permissions

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