Results 1 to 2 of 2

Thread: ORDER BY id ASC

  1. #1
    Join Date
    Jul 2004
    Posts
    494

    Unanswered: ORDER BY id ASC

    WHy does it say

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /biblethewheelofgod/query.asp, line 146

    ORDER BY id ASC
    ---------^
    It seems like I've misplaced it but don't know where it should go.

    Code:
    <%  Dim strConn     ' Database connection string
        Dim SQL         ' String that will have our SQL statments
        Dim RS          ' Recordset object
        Dim Keyword     ' Keyword for search
    'pageing
        Dim nRecCount   ' Number of records found
        Dim nPageCount  ' Number of pages of records we have
        Dim nPage       ' Current page number
    'query
        Dim iCounter
        Dim iLoopCount
        Dim aRecTypes
        Dim spoke       ' For dropdown
        Dim number
        Dim Keywordb
        Dim Keywordc
        Dim intRec
    
    SQL= "SELECT * from bible where "
    
        ' Let's see what user wants to search for today :)
        Keyword = Trim(Request.QueryString("Keyword"))
        spoke = Request.Querystring("spoke")
        number = Request.QueryString("number")
        Keywordb = Request.QueryString("Keywordb")
        Keywordc = Request.QueryString("Keywordc")
    
    iCounter = 0
    
    If   request.QueryString("text_data")="yes" then
    
      SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "  
      SQL = SQL & "text_data LIKE '%" & Keywordb & "%' AND "
      SQL = SQL & "text_data LIKE '%" & Keywordc & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    
    If   request.QueryString("book")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "book LIKE '" & number & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    
    If   request.QueryString("book_title")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "book_title LIKE '%" & number & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("chapter")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "chapter LIKE '%" & number & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("verse")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "verse LIKE '%" & number & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("book_spoke")="Book_Spoke" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "book_spoke = '" & spoke & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("chapter_spoke")="Chapter_Spoke" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "chapter_spoke = '" & spoke & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("verse_spoke")="Verse_Spoke" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "verse_spoke = '" & spoke & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    If Trim(Request.QueryString("recordType")) <> "" Then
    
    
      aRecTypes = Split(Request.QueryString("recordType"), ",")
    
      If IsArray(aRecTypes) Then 'This is a bit redundant, but it can't hurt
        SQL = SQL & " AND ("
    
        For iLoopCount = 0 To UBound(aRecTypes)
          If iLoopCount <> 0 Then
            SQL = SQL & " OR "
          End If
    
          SQL = SQL & "recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
        Next
      End If
      SQL = SQL & ")"
    End If
    
    SQL = SQL 
    ORDER BY id ASC
    %>

  2. #2
    Join Date
    Dec 2003
    Posts
    148
    I didnt look through all your code, so assuming 146 is that last one or so...

    Code:
    SQL = SQL + "ORDER BY id ASC"
    You have to concat, just like you did everywhere else.

Posting Permissions

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