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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

End of statement? 2

Status
Not open for further replies.

lynque

IS-IT--Management
Sep 30, 2004
124
CA
I'm relatively new to ASP and have been trying to troubleshoot this query for sometime now...

Code:
sqlText = "INSERT INTO itemsOrdered " _
            & " (orderID, productDesc, productID, itemPrice, beforeTax, sAmt, GST, PST, quantity) values " _ 
            & " ("&intOrderID&", '"&(strProdName)&"', "&intStock&", "&intPrice&", "&intExtPrice&", "&intShipping&", "&intTax&", "&intPST&", "&intQuant&")"
        Conn.Execute(sqlText)

It is throwing this error

Microsoft VBScript compilation (0x800A0401)
Expected end of statement

Any suggestions are appreciated
 
Did you try '"&strProdName&"' instead of '"&(strProdName)&"'

-DNG
 
may be you need a semicolon in the end of the query..what database are you using??

-DNG
 
It looks like you are missing the underscore _ to continue the second line of your SQL statement.
 
Sounds like you may have an issue with the syntax that it is expecting you've already ended your statement (or, correspondingly, not ended it where you think). Have you tried to response.write your sqlText and then tested it in your database to ensure that it is working as you think it should? If you have further questions, please post the line that your error is specifically hitting on.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Oh nevermind what I said about the underscore, my screen was not wide enough and it wrapped into a third line in the display.
 
try it all on one line
Code:
sqlText = "INSERT INTO itemsOrdered (orderID, productDesc, productID, itemPrice, beforeTax, sAmt, GST, PST, quantity) values ("&intOrderID&", '"&(strProdName)&"', "&intStock&", "&intPrice&", "&intExtPrice&", "&intShipping&", "&intTax&", "&intPST&", "&intQuant&")"

Conn.Execute(sqlText)

Tony
_______________________________________________________________
 
Thanks for all the responses,

I tried removing the brackets as suggested by DNG but still get the same error, semicolon or no semicolon.

The line the error occurs is /validateOrder.asp, line 194 which is the Conn.Execute(sqlText) command.
 
Take Chopstik's advice and add:
Response.Write sqlText

just to see that it is what you think it should be....
 
lynque
From the stars it would appear that you have solved your problem. So that others may benefit from this in future would you be able to post the final solution.

Tony
_______________________________________________________________
 
Tony, (and everyone else)

The solution became obvious after outputting the query, I had set a variable twice in the process of passing the data from page to page and the insert was trying to insert productID (eg. 12345) as 12345, 12345. The type mismatch error was thrown because the destination field is a number field and obviously a comma is not a number.

Thanks for all of your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top