Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Incorrect Syntax near "," doesnt make sense

Reply
Thread Tools

Incorrect Syntax near "," doesnt make sense

 
 
J. Muenchbourg
Guest
Posts: n/a
 
      09-23-2003


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,art icleheader,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!
 
Reply With Quote
 
 
 
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      09-23-2003
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" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
>
>
> 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,art icleheader,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!



 
Reply With Quote
 
 
 
 
Curt_C [MVP]
Guest
Posts: n/a
 
      09-23-2003
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" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
>
>
> 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,art icleheader,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!



 
Reply With Quote
 
middletree
Guest
Posts: n/a
 
      09-23-2003
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" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
>
>
> 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,art icleheader,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!



 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      09-24-2003
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
>
> 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,art icleheader,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!



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      09-24-2003
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line 1: Incorrect syntax near ')'. how to fix it levis ASP .Net 0 09-20-2006 10:19 AM
Incorrect syntax near 'int' David ASP .Net 7 04-07-2006 05:35 PM
Visual Studio Incorrect Syntax Near The Keyword Default Information JMUApache ASP .Net 2 09-04-2005 12:41 PM
SqlClient.SqlException: Line 1: Incorrect syntax near '='. Patrick Olurotimi Ige ASP .Net 4 03-18-2005 01:53 PM
System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 3 10-11-2004 10:21 AM



Advertisments