Print Page | Close Window

Error Message With SQLString

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12088
Printed Date: 29 March 2026 at 3:12am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Error Message With SQLString
Posted By: Misty
Subject: Error Message With SQLString
Date 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.




Replies:
Posted By: vshriniwasan
Date 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...



Posted By: Mart
Date Posted: 09 October 2004 at 3:52am
You need to do that and put a space before the where



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