INvalid syntax

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J. Muenchbourg

    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(art icleid,articleD ate,sport,artic leheader,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

    #2
    Re: INvalid syntax

    s = "INSERT INTO
    tblArticles(art icleid,articleD ate,sport,artic leheader,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:OuKs65sfDH A.2364@TK2MSFTN GP09.phx.gbl...[color=blue]
    > 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(art icleid,articleD ate,sport,artic leheader,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![/color]


    Comment

    • Aaron Bertrand - MVP

      #3
      Re: INvalid syntax

      > 'articleid' is a primary key.

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


      Comment

      • Tom B

        #4
        Re: INvalid syntax

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



        "J. Muenchbourg" <jodaddy@canada .com> wrote in message
        news:OuKs65sfDH A.2364@TK2MSFTN GP09.phx.gbl...[color=blue]
        > 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(art icleid,articleD ate,sport,artic leheader,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![/color]


        Comment

        • J. Muenchbourg

          #5
          Re: INvalid syntax



          dim sqlid
          sqlid = "SELECT max articleid from tblarticles"
          Set rsid = Server.CreateOb ject("ADODB.Rec ordset")
          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!

          Comment

          • Tom B

            #6
            Re: INvalid syntax

            Aaron asked how you CREATED the articleid, is it an Identity(SQL Server) or
            Autonumber(Acce ss)
            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:OmBIA3tfDH A.1872@TK2MSFTN GP09.phx.gbl...[color=blue]
            >
            >
            > dim sqlid
            > sqlid = "SELECT max articleid from tblarticles"
            > Set rsid = Server.CreateOb ject("ADODB.Rec ordset")
            > 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![/color]


            Comment

            Working...