NEED SQL HELP..Expected End of Statement
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5887
Printed Date: 31 March 2026 at 8:41am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: NEED SQL HELP..Expected End of Statement
Posted By: tworth
Subject: NEED SQL HELP..Expected End of Statement
Date Posted: 22 September 2003 at 5:36am
|
I need some serious help here. I am working on a time schedule, writing a script for my unit, ove here in the desert (IRAQ). I am getting the following error, in my asp page. I am writting a page to search a database, and provide the records on a results page. Heres the error..
Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of statement /blue2results.asp, line 51, column 28 rsResults.Source = "SELECT "DIVENG FRAGO", "Group Frago", "MSN_Number", "Work Unit", "Complete", "Priority Mission" FROM "BLUE 2 PROJECTS" WHERE "DIVENG FRAGO" LIKE '" + Replace(rsResults__vardivfrago, "'", "''") + "' OR "Group Frago" LIKE '" + Replace(rsResults__vargroupfrago, "'", "''") + "' OR "MSN Number" LIKE '" + Replace(rsResults__varmsnnumber, "'", "''") + "' OR "Work Unit" LIKE '" + Replace(rsResults__varworkunit, "'", "''") + "' OR "Complete" LIKE '" + Replace(rsResults__varcomplete, "'", "''") + "' OR "Priority Mission" LIKE '" + Replace(rsResults__varprioritymission, "'", "''") + "'"; ---------------------------^
------------- Spc Worth
US Army
Operation Iraqi Freedom
|
Replies:
Posted By: KCWebMonkey
Date Posted: 22 September 2003 at 8:49am
|
Expected end of statment usually means that you have an "If" statement without an "End If". Just check your code.
|
Posted By: ljamal
Date Posted: 22 September 2003 at 9:47am
Not necessary, it means the processor expected the statement to end and it didn't.
The problem here is the quotes. Change your select list to * and work out the problems. In the future, I would suggest not using Column name with spaces.
------------- L. Jamal Walton
http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming
|
Posted By: Bluefrog
Date Posted: 23 September 2003 at 9:07am
tworth wrote:
I need some serious help here. I am working on a time schedule, writing a script for my unit, ove here in the desert (IRAQ). I am getting the following error, in my asp page. I am writting a page to search a database, and provide the records on a results page. Heres the error..
Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of statement /blue2results.asp, line 51, column 28 rsResults.Source = "SELECT "DIVENG FRAGO", "Group Frago", "MSN_Number", "Work Unit", "Complete", "Priority Mission" FROM "BLUE 2 PROJECTS" WHERE "DIVENG FRAGO" LIKE '" + Replace(rsResults__vardivfrago, "'", "''") + "' OR "Group Frago" LIKE '" + Replace(rsResults__vargroupfrago, "'", "''") + "' OR "MSN Number" LIKE '" + Replace(rsResults__varmsnnumber, "'", "''") + "' OR "Work Unit" LIKE '" + Replace(rsResults__varworkunit, "'", "''") + "' OR "Complete" LIKE '" + Replace(rsResults__varcomplete, "'", "''") + "' OR "Priority Mission" LIKE '" + Replace(rsResults__varprioritymission, "'", "''") + "'"; ---------------------------^
|
Change it to:
rsResults.Source = "SELECT ""DIVENG FRAGO"", ""Group Frago"", ""MSN_Number"", ""Work Unit"", ""Complete"", ""Priority Mission"" FROM ""BLUE 2 PROJECTS"" WHERE ""DIVENG FRAGO"" LIKE '""" + Replace(rsResults__vardivfrago, "'", "''") + """' OR ""Group Frago"" LIKE '" + Replace(rsResults__vargroupfrago, "'", "''") + "' OR ""MSN Number"" LIKE '" + Replace(rsResults__varmsnnumber, "'", "''") + "' OR ""Work Unit"" LIKE '" + Replace(rsResults__varworkunit, "'", "''") + "' OR ""Complete"" LIKE '" + Replace(rsResults__varcomplete, "'", "''") + "' OR ""Priority Mission"" LIKE '" + Replace(rsResults__varprioritymission, "'", "''") + "'"
Then buy a text editor with decent syntax highlighting.
|
Posted By: Bluefrog
Date Posted: 23 September 2003 at 9:09am
|
The reason being:
rsResults.Source = "SELECT "
is the entire statement. That quote ended the statement. You need to "doubleup" with quotes inside of string literals.
|
|