INvalid syntax

J

J. Muenchbourg

an Incorrect syntax near ','. (Line 1) is what I'm getting with this
insert statement, the error pointing to the sql execute:

"INSERT INTO
tblArticles(articleid,articleDate,sport,articleheader,fpick,articleText)
"_
& "VALUES (" & articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"

'articleid' is a primary key.

???
Muench
 
R

Ray at

s = "INSERT INTO
tblArticles(articleid,articleDate,sport,articleheader,fpick,articleText)
"_
& "VALUES (" & articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"


RESPONSE.WRITE S
RESPONSE.END

What does that produce?

Ray at work
 
A

Aaron Bertrand - MVP

'articleid' is a primary key.

So how are you populating this? Where does articleid get generated?
 
J

J. Muenchbourg

dim sqlid
sqlid = "SELECT max articleid from tblarticles"
Set rsid = Server.CreateObject("ADODB.Recordset")
rsid.Open sqlid,sqlc,3

articleid = rsid("articleid")
rsid.Close
set rsid = nothing


in response to Tom's question about 'sport', yes it is an integer
datatype
 
T

Tom B

Aaron asked how you CREATED the articleid, is it an Identity(SQL Server) or
Autonumber(Access)
if it is, then you can't insert a value, which you are doing in your insert
statement.
If it's not an Identity/Autonumber, are you ensuring it's unique? You said
it was a Primary Key, so it has to be unique.
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top