Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Error Message With SQLString
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Error Message With SQLString

 Post Reply Post Reply
Author
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Topic: Error Message With SQLString
    Posted: 09 October 2004 at 1:43am

I am trying to get a sql string on an ASP.Net page to work. I want the web page to only show spa stores that have a listingtype that is equal to National.

Here's the error code that I am getting:

Compiler Error Message: BC30205: End of statement expected.

Source Error:

Line 33:      
Line 34:              'Add Order By 
Line 35:              strSQL = strSQL & "where ListingType="National"
Line 36: 			 strSQL = strSQL & " Order By SpaStoreName" 

 

Here's my code:

              'Start SQL statement
              strSQL = "Select * From SpaStore"
    
              'Add Order By
              strSQL = strSQL & "where ListingType="National"    strSQL = strSQL & " Order By SpaStoreName"

I also tried 'National'" and '"National"'", but they didn't work.

Back to Top
vshriniwasan View Drop Down
Groupie
Groupie
Avatar

Joined: 17 December 2001
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote vshriniwasan Quote  Post ReplyReply Direct Link To This Post Posted: 09 October 2004 at 1:58am

The problem is with your Concatenation... Try this...

strSQL = strSQL & "where ListingType='National'"

if you want to specify a variable for the National then..

 

strSQL = strSQL & "where ListingType='" & varname & "'"

Hope this helps...

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: 09 October 2004 at 3:52am
You need to do that and put a space before the where
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.