Print Page | Close Window

Adding case select.

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=11117
Printed Date: 30 March 2026 at 12:10pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Adding case select.
Posted By: Badaboem
Subject: Adding case select.
Date Posted: 07 July 2004 at 9:23am
I'm currently trying to add case select in order to have some control over the returned results from the database, but i receive an error.
What am i doing wrong here?
Thanks in advance.


Set rsDownload = Server.CreateObject("ADODB.RecordSet")
    strSQL = "SELECT Download_ID, Download_Preview, Download_Preview_Movie, Download_Version, D_FreeCommercial, Download_Name, D_Short, D_Added, Download_Hits, Download_SubCat, DComments " _
        & " FROM " & strDbTable & "Downloads WHERE " & strDbTable & "Downloads.Download_SubCat = " & scid & "" _ 
   
    Select Case Trim(Mid(Request.QueryString("OO"), 1, 3))
    Case "3"
        & " ORDER BY Download_Hits DESC;"
    Case "4"

    Case "2"
       
    Case Else

End Select
       

    rsDownload.CursorType = 1
    rsDownload.Open strSQL, adoCon


I still have to fill in the other cases, but when i tried with one i got the error:

Expected end of statement

/c4dportal2/forum/functions/3rdparty/functions_download.asp, line 397

Select Case Trim(Mid(Request.QueryString("OB"), 1, 3))




Replies:
Posted By: Mart
Date Posted: 07 July 2004 at 11:26am

The problem is the underscore (I highlighted the offending one in red):

Set rsDownload = Server.CreateObject("ADODB.RecordSet")
    strSQL = "SELECT Download_ID, Download_Preview, Download_Preview_Movie, Download_Version, D_FreeCommercial, Download_Name, D_Short, D_Added, Download_Hits, Download_SubCat, DComments " _
        & " FROM " & strDbTable & "Downloads WHERE " & strDbTable & "Downloads.Download_SubCat = " & scid & "" _ 
   
    Select Case Trim(Mid(Request.QueryString("OO"), 1, 3))
    Case "3"
        & " ORDER BY Download_Hits DESC;"
    Case "4"

    Case "2"
       
    Case Else

End Select

Remove that and it should work.



Posted By: Badaboem
Date Posted: 07 July 2004 at 11:45am
Do you mean the last "_" from this part?  " & scid & "" _

I tried and now the error result is

/c4dportal2/forum/functions/3rdparty/functions_download.asp, line 399

& " ORDER BY Download_Hits DESC;"
^

when the QueryString is OO 3




Posted By: Mart
Date Posted: 07 July 2004 at 11:54am

Try this

Set rsDownload = Server.CreateObject("ADODB.RecordSet")
    strSQL = "SELECT Download_ID, Download_Preview, Download_Preview_Movie, Download_Version, D_FreeCommercial, Download_Name, D_Short, D_Added, Download_Hits, Download_SubCat, DComments " _
        & " FROM " & strDbTable & "Downloads WHERE " & strDbTable & "Downloads.Download_SubCat = " & scid
    
    Select Case Trim(Mid(Request.QueryString("OO"), 1, 3))
    Case "3"
        strSQL = strSQL & " ORDER BY Download_Hits DESC;"
    Case "4"

    Case "2"
       
    Case Else

End Select

 



Posted By: Badaboem
Date Posted: 07 July 2004 at 11:57am
Thanks for the info.
Rewritten and working now.

    Set rsDownload = Server.CreateObject("ADODB.RecordSet")
    strSQL = "SELECT Download_ID, Download_Preview, Download_Preview_Movie, Download_Version, D_FreeCommercial, Download_Name, D_Short, D_Added, Download_Hits, Download_SubCat, DComments "  
    strSQL = strSQL & " FROM " & strDbTable & "Downloads WHERE " & strDbTable & "Downloads.Download_SubCat = " & scid & "" 
        Select Case Trim(Mid(Request.QueryString("BO"), 1, 3))
    Case "3"
    strSQL = strSQL & " ORDER BY Download_Hits DESC;"
    Case "4"



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net