Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - NEED SQL HELP..Expected End of Statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

NEED SQL HELP..Expected End of Statement

 Post Reply Post Reply
Author
tworth View Drop Down
Newbie
Newbie
Avatar

Joined: 22 September 2003
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote tworth Quote  Post ReplyReply Direct Link To This Post Topic: NEED SQL HELP..Expected End of Statement
    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, "'", "''") + "'";
---------------------------^

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bluefrog Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2003 at 9:07am
Originally posted by tworth 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.

 

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bluefrog Quote  Post ReplyReply Direct Link To This Post 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.

 

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.