Re: Syntax error in INSERT INTO statement.
From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 06/25/04
- Next message: Jeff Cochran: "Re: Run Batch file from ASP"
- Previous message: Tom Lavedas: "RE: Run Batch file from ASP"
- In reply to: SAM: "Syntax error in INSERT INTO statement."
- Next in thread: SAM: "Re: Syntax error in INSERT INTO statement."
- Reply: SAM: "Re: Syntax error in INSERT INTO statement."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Jun 2004 12:00:24 -0400
SAM wrote:
> Hi All,
> When I run the following code,
> set cn=server.CreateObject("ADODB.Connection")
> SQL2="INSERT into [ShoppingCart]([SCSessionID],[ProductID], [PPrice])"
> SQL2=SQL2 + " VALUES ( "&Session.SessionID&" , '"&ProductID&"' ,
> "&PPrice&")"
> cn.Execute SQL2
>
> I got syntax error in INSERT INTO statement. I don't what's wrong.
> It's killing me. If anyone can help, it will be appreciated. By the
> way, SCSessionID is number, ProductID is text and PPrice is currency.
> I am using Access as DB.
>
> Thanks.
The first step when debugging sql syntax errors is to look at the query as
the database is seeing it. The best way to do that is to response.write it:
Response.Write SQL2
Response.End
Run the page and look at the sql statement in the browser window. If the
problem does not stick out like a sore thumb, open your database in Access,
go to the Queries tab, start a new query in Design view, closing the Choose
Tables dialog without choosing a table, switch to SQL View, paste the
statement in from the browser window and try to run it. You should get a
better error message. If you still can't see what the problem is, show us
the sql statement.
Bob Barrows
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
- Next message: Jeff Cochran: "Re: Run Batch file from ASP"
- Previous message: Tom Lavedas: "RE: Run Batch file from ASP"
- In reply to: SAM: "Syntax error in INSERT INTO statement."
- Next in thread: SAM: "Re: Syntax error in INSERT INTO statement."
- Reply: SAM: "Re: Syntax error in INSERT INTO statement."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|