473,748 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Incorrect Syntax near "," doesnt make sense



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(han did,articleid,a rticleDate,spor t,articleheader ,fpick,artic
leText)"_
& "VALUES ('" & handid & "', " _
& articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"
response.write strSQLstatement
Conn.Execute(st rSQLStatement)

????
Thanks in advance
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
5 45076
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" <jo*****@canada .com> wrote in message
news:#u******** ******@tk2msftn gp13.phx.gbl...


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(han did,articleid,a rticleDate,spor t,articleheader ,fpick,artic
leText)"_
& "VALUES ('" & handid & "', " _
& articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"
response.write strSQLstatement
Conn.Execute(st rSQLStatement)

????
Thanks in advance
Muench

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

Jul 19 '05 #2
show us the Response.Write of that statement, also which are string, which
are int
--
----------------------------------------------------------
Curt Christianson (Software_AT_Da rkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"J. Muenchbourg" <jo*****@canada .com> wrote in message
news:#u******** ******@tk2msftn gp13.phx.gbl...


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(han did,articleid,a rticleDate,spor t,articleheader ,fpick,artic
leText)"_
& "VALUES ('" & handid & "', " _
& articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"
response.write strSQLstatement
Conn.Execute(st rSQLStatement)

????
Thanks in advance
Muench

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

Jul 19 '05 #3
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" <jo*****@canada .com> wrote in message
news:#u******** ******@tk2msftn gp13.phx.gbl...


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(han did,articleid,a rticleDate,spor t,articleheader ,fpick,artic
leText)"_
& "VALUES ('" & handid & "', " _
& articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"
response.write strSQLstatement
Conn.Execute(st rSQLStatement)

????
Thanks in advance
Muench

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

Jul 19 '05 #4
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(st rSQLStatement)

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" <jo*****@canada .com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..


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(han did,articleid,a rticleDate,spor t,articleheader ,fpick,artic
leText)"_
& "VALUES ('" & handid & "', " _
& articleid & ", '" _
& articledate & "', " _
& sport & ", '" _
& articleheader & "', '" _
& fpick & "', '" _
& articleText & "')"
response.write strSQLstatement
Conn.Execute(st rSQLStatement)

????
Thanks in advance
Muench

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

Jul 19 '05 #5
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(st rSQLStatement)

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 adExecuteNoReco rds. If
you have the ADO constants defined, you can do this instead:
Conn.Execute strSQLStatement ,,adCmdText + adExecuteNoReco rds
HTH,
Bob Barrows
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
14194
by: Jeff Magouirk | last post by:
Dear Group, I am trying to create a view and keep getting the Incorrect syntax near the keyword 'Declare'" error. Here is the code I am writing. Create view fixed_airs (sid, fad_a2, fad_a3) as Declare @sid int, @fad_a2 int,
3
2875
by: Michael | last post by:
Hi Everyone, I'm having a slight problem, I hope I didn't overlook something. I'm getting the following error when I try to execute the function below: Incorrect syntax near 'intake_GetListSet'." Private sub LoadListSet() dim da as New SqlDataAdapter Dim cmd as New SqlCommand try cmd.Connection = OpenConnection()
1
11249
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." Explaining you the scene is the following Stored Proc.
1
2356
by: iporter | last post by:
In the following code, the two Response.Write statements output exactly the same - I can copy and paste both into Query Analyzer, and run them fine. However, if I comment out line 3, the assignment of "SELECT T..." to the variable query, the last line produces the error: Line 1: Incorrect syntax near '<'. Many thanks in advance for any explanation - the problem is tearing my hair out!! Iain
3
28919
by: wallic | last post by:
Hello, This is my first post and I am a beginner with SQL code. The code below is supposed to update a new table (loctable) with a calculated value based on the original table (hra_data). There are 3 possibilities in the hra_data table that will cause the loctable to be updated with the calculated value. After playing with it, I thought it was in the correct format but I keep getting an "Incorrect syntax..." error. Any guidence would be...
0
8326
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new records there is an error "Incorrect syntax near '-'. Must declare the scalar variable "@UserName". I worked out in design view,code is automatically generated.Iam not able fix the error. Iam working with Visual Web Developer-2005 Express Edition
1
3360
by: itamar82 | last post by:
I am getting the following error: Microsoft OLE DB Provider for SQL Server error '80040e14' Incorrect syntax near the keyword 'WHERE'. for the sql below: SELECT TourId FROM (SELECT ROW_NUMBER() OVER (ORDER BY BaseTours.DateCreated DESC) AS RowNumber
10
3423
by: arial | last post by:
Hi, I am getting this error message: Incorrect syntax near the keyword 'where'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'where'. Source Error:
1
6262
by: karenkksh | last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'user'. Source Error: Line 35: MyAdapter1 = new SqlDataAdapter(MyCommand1); Line 36: MyDataSet1 = new DataSet(); Line 37: ...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.