Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expected end of statement - My eyes Hurt 1

Status
Not open for further replies.

dcwave

IS-IT--Management
May 18, 2003
46
US
I suck at query writing. Can anyone help me out? Its probably something simple I am leaving out.

Thanks

CODE:

Code:
strSQL = "SELECT DatePart("m",[DateSold]) AS AMonth, Sum(Amount) AS MonthTotal FROM sales GROUP BY DatePart("m",[DateSold])ORDER BY DatePart("m",[DateSold])"
Error:

xpected end of statement
/sales/salespublic.asp, line 7, column 27
strSQL = "SELECT DatePart("m",[DateSold]) AS AMonth, Sum(Amount) AS MonthTotal FROM sales GROUP BY DatePart("m",[DateSold])ORDER BY DatePart("m",[DateSold])"
--------------------------^
 
You need to use double-double-quotes to represent literal double-quotes. Otherwise the string is terminated. Try this (haven't checked your SQL, just saw the quote problem):
Code:
strSQL = "SELECT DatePart("[COLOR=blue]"[/color]m"[COLOR=blue]"[/color],[DateSold]) AS AMonth, Sum(Amount) AS MonthTotal FROM sales GROUP BY DatePart("[COLOR=blue]"[/color]m"[COLOR=blue]"[/color],[DateSold])ORDER BY DatePart("[COLOR=blue]"[/color]m"[COLOR=blue]"[/color],[DateSold])"
 
Thanks

Threw an error:

Microsoft JET Database Engine (0x80040E14)
Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
 
Right after the line above, add this:
Code:
Response.Write("<h3>" & strSQL & "</h3>")
Response.Flush
You'll still get the error, but you'll be able to see exactly what SQL is being sent to the db. If it looks valid, copy it and run the query over in Access to see what results you get.
 
Yea.... its working. I have been at work for 14 hours. my eyes are tired. I normally design voice networks - not code asp.

I had strSQL = strSQL = blah blah... the double quotes are what worked.

Thanks alot for the help!
 
Ah, great. Heck, my tired eyes didn't notice that there was no point in response.writing it. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top