Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   INvalid syntax (http://www.velocityreviews.com/forums/t790346-invalid-syntax.html)

J. Muenchbourg 09-19-2003 04:52 PM

INvalid syntax
 
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,articlehea der,fpick,articleText)
"_
& "VALUES (" & articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"

'articleid' is a primary key.

???
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Ray at 09-19-2003 05:00 PM

Re: INvalid syntax
 
s = "INSERT INTO
tblArticles(articleid,articleDate,sport,articlehea der,fpick,articleText)
"_
& "VALUES (" & articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"


RESPONSE.WRITE S
RESPONSE.END

What does that produce?

Ray at work

"J. Muenchbourg" <jodaddy@canada.com> wrote in message
news:OuKs65sfDHA.2364@TK2MSFTNGP09.phx.gbl...
> 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,articlehea der,fpick,articleText)
> "_
> & "VALUES (" & articleid & ", '" _
> & articledate & "', " _
> & sport & ", '" _
> & articleheader & "', '" _
> & fpick & "', '" _
> & articleText & "')"
>
> 'articleid' is a primary key.
>
> ???
> Muench
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!




Aaron Bertrand - MVP 09-19-2003 05:10 PM

Re: INvalid syntax
 
> 'articleid' is a primary key.

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



Tom B 09-19-2003 05:30 PM

Re: INvalid syntax
 
is sport a number field?
is articleid an Identity field?



"J. Muenchbourg" <jodaddy@canada.com> wrote in message
news:OuKs65sfDHA.2364@TK2MSFTNGP09.phx.gbl...
> 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,articlehea der,fpick,articleText)
> "_
> & "VALUES (" & articleid & ", '" _
> & articledate & "', " _
> & sport & ", '" _
> & articleheader & "', '" _
> & fpick & "', '" _
> & articleText & "')"
>
> 'articleid' is a primary key.
>
> ???
> Muench
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!




J. Muenchbourg 09-19-2003 06:42 PM

Re: INvalid syntax
 


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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom B 09-19-2003 07:33 PM

Re: INvalid syntax
 
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.



"J. Muenchbourg" <jodaddy@canada.com> wrote in message
news:OmBIA3tfDHA.1872@TK2MSFTNGP09.phx.gbl...
>
>
> 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
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!





All times are GMT. The time now is 09:03 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.