INvalid syntax

Discussion in 'ASP General' started by J. Muenchbourg, Sep 19, 2003.

  1. 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

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    J. Muenchbourg, Sep 19, 2003
    #1
    1. Advertising

  2. J. Muenchbourg

    Ray at Guest

    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

    "J. Muenchbourg" <> wrote in message
    news:...
    > 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Ray at, Sep 19, 2003
    #2
    1. Advertising

  3. > 'articleid' is a primary key.

    So how are you populating this? Where does articleid get generated?
     
    Aaron Bertrand - MVP, Sep 19, 2003
    #3
  4. J. Muenchbourg

    Tom B Guest

    is sport a number field?
    is articleid an Identity field?



    "J. Muenchbourg" <> wrote in message
    news:...
    > 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Tom B, Sep 19, 2003
    #4
  5. 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!
     
    J. Muenchbourg, Sep 19, 2003
    #5
  6. J. Muenchbourg

    Tom B Guest

    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" <> wrote in message
    news:...
    >
    >
    > 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, Sep 19, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFyayBQaGFuaWRlcw==?=

    Intermittant redirect to Invalid Syntax Error page

    =?Utf-8?B?TWFyayBQaGFuaWRlcw==?=, Feb 16, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    511
    =?Utf-8?B?TWFyayBQaGFuaWRlcw==?=
    Feb 16, 2004
  2. Patrick.O.Ige
    Replies:
    1
    Views:
    1,996
    Patrick.O.Ige
    Jul 2, 2006
  3. Java Guy
    Replies:
    1
    Views:
    702
    Manish Pandit
    Oct 15, 2006
  4. kevin
    Replies:
    0
    Views:
    1,012
    kevin
    Jan 16, 2008
  5. Java Guy
    Replies:
    1
    Views:
    326
Loading...

Share This Page