Author
Topic Search Topic Options
Badaboem
Senior Member
Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options
Thanks(0)
Quote Reply
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))
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options
Thanks(0)
Quote Reply
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
Badaboem
Senior Member
Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options
Thanks(0)
Quote Reply
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
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options
Thanks(0)
Quote Reply
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
Badaboem
Senior Member
Joined: 12 April 2002
Location: Netherlands
Status: Offline
Points: 600
Post Options
Thanks(0)
Quote Reply
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"
Forum Jump
-- Select Forum --
Network Status and Announcements
Web Wiz Hosting Services Pre-Sales Questions
Web Wiz Hosting Support Forums
Web Wiz Hosting Support Ticket System
Web Wiz Forums
- Web Wiz Forums Modifications
- Web Wiz Forums Skins
- Web Wiz Forums Language Files
- Web Wiz Forums Suggestions
Web Wiz Forums Demo
Web Wiz NewsPad
Web Wiz CAPTCHA
Web Wiz Rich Text Editor (RTE)
General Discussion
Web Design Discussion
ASP.NET Discussion
Classic ASP Discussion
PHP Discussion
Database Discussion
Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
Forum Software by Web Wiz Forums® version 12.08 Copyright ©2001-2026 Web Wiz Ltd.