Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Adding case select.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding case select.

 Post Reply Post Reply
Author
Badaboem View Drop Down
Senior Member
Senior Member


Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options Post Options   Thanks (0) Thanks(0)   Quote Badaboem Quote  Post ReplyReply Direct Link To This Post Topic: Adding case select.
    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))

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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.



Edited by Mart
Back to Top
Badaboem View Drop Down
Senior Member
Senior Member


Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options Post Options   Thanks (0) Thanks(0)   Quote Badaboem Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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

 



Edited by Mart
Back to Top
Badaboem View Drop Down
Senior Member
Senior Member


Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options Post Options   Thanks (0) Thanks(0)   Quote Badaboem Quote  Post ReplyReply Direct Link To This Post 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"
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.