Incorrect Syntax near "," doesnt make sense

J

J. Muenchbourg

IN the code below, I am getting an Incorrect Syntax near "," error (the
sql execute line, and it is pointing to position 1 ) (the display
formatting here may look different than my script):

strSQLStatement = "INSERT INTO
tblArticles(handid,articleid,articleDate,sport,articleheader,fpick,artic
leText)"_
& "VALUES ('" & handid & "', " _
& articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"
response.write strSQLstatement
Conn.Execute(strSQLStatement)

????
Thanks in advance
Muench
 
A

Aaron Bertrand - MVP

One of your values is empty. What does the response.write line show (seeing
your SQL statement prior to variable substitution is quite useless).
 
C

Curt_C [MVP]

show us the Response.Write of that statement, also which are string, which
are int
 
M

middletree

What Aaron says is best, but I would add that there is a possibility that
you have a comma(or some other kind of show-stopper) in one of your values.
Bottom line is to do a response.write
 
T

Tom B

It wouldn't hurt to throw some spaces in, I don't think T-SQL cares, but you
have no spaces after your table name or after your closing brace on the
column list.


After you resolve your SQL Problem, I believe this will cause a problem
Conn.Execute(strSQLStatement)

Execute is a function, but since you aren't doing anything with the return
value, you should call it as though it were a subroutine

Conn.Execute strSQLStatement
 
B

Bob Barrows

Tom said:
It wouldn't hurt to throw some spaces in, I don't think T-SQL cares,
but you have no spaces after your table name or after your closing
brace on the column list.


After you resolve your SQL Problem, I believe this will cause a
problem Conn.Execute(strSQLStatement)

Execute is a function, but since you aren't doing anything with the
return value, you should call it as though it were a subroutine

Conn.Execute strSQLStatement
You should also tell ADO what type of command you are executing, and that
you do not want it to construct a recordset:
Conn.Execute strSQLStatement,,129

129 is the addition of two constants: adCmdText and adExecuteNoRecords. If
you have the ADO constants defined, you can do this instead:
Conn.Execute strSQLStatement,,adCmdText + adExecuteNoRecords


HTH,
Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top