Incorrect Syntax near "," doesnt make sense

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

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

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

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



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

  3. J. Muenchbourg

    Curt_C [MVP] Guest

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


    --
    ----------------------------------------------------------
    Curt Christianson (Software_AT_Darkfalz.Com)
    Owner/Lead Designer, DF-Software
    http://www.Darkfalz.com
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------


    "J. Muenchbourg" <> wrote in message
    news:#...
    >
    >
    > 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Curt_C [MVP], Sep 23, 2003
    #3
  4. J. Muenchbourg

    middletree Guest

    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


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

    Tom B Guest

    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





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

    Bob Barrows Guest

    Tom B wrote:
    > 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
    Bob Barrows, Sep 24, 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?UGF0cmljay5PLklnZQ==?=

    System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 11, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    10,686
    Patrick.O.Ige
    Oct 11, 2004
  2. Patrick Olurotimi Ige
    Replies:
    4
    Views:
    6,999
    Patrick Olurotimi Ige
    Mar 18, 2005
  3. JMUApache
    Replies:
    2
    Views:
    3,289
    Brendan Reynolds
    Sep 4, 2005
  4. David

    Incorrect syntax near 'int'

    David, Apr 6, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    2,460
    David
    Apr 7, 2006
  5. levis
    Replies:
    0
    Views:
    3,478
    levis
    Sep 20, 2006
Loading...

Share This Page