472,951 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.

syntax error near ',' in insert command

hi,can anybody tell reason for getting syntax error near , while either updating or inserting records in table
Sep 12 '07 #1
3 2276
markrawlingson
346 Expert 100+
Because the syntax of your SQL statement is incorrect.

Show us your SQL statement so we can see it and possibly point out your error.

In addition, whenever you face a problem like this it's a good idea to Response.Write your SQL statement to see what it REALLY says.

Sincerely,
Mark
Sep 12 '07 #2
Thank you markrawlingson..
this is the sql command i got error from tis line.following is the code for updating and inserting records in table


[conn.execute " update enquiry set Etype='" & text(1) & "', regid ='" & text(2) & "', cname='" & text(3) & "', address='" & text(4) & "', salesperson='" & text(5) & "', through='" & text(6) & "', contactperson='" & text(7) & "',phoff='" & text(8) & "',phres='" & text(9) & "', mobile=" & text(10) & ",faxno='" & text(11) & "', email='" & text(12) & "', edate='" & text(13)& "', etime='" & cdate(text(14)) & "', thruby='" & text(15) & "', dob='" & text(16) & "', anniversarydate='" & text(17) & "', refby='" & text(18) & "', segmentname='" & text(19) & "',enquirytype='" & text(20) & "', branchid='" & text(21) & "' where regid= '" & text(2) & "' and branchid='" & text(21) & "' "]
[conn.execute "insert into enquiry values('" & text(1) & "', '" & text(2) & "', '" & text(3) & "', '" & text(4) & "', '" & text(5) & "', '" & text(6) & "', '" & text(7) & "', '" & text(8) & "', '" & text(9) & "', " & text(10) & ", '" & text(11) & "', '" & text(12) & "', '" & text(13) & "','" & cdate(text(14)) & "', '" & text(15) & "','" & text(16) & "', '" & text(17) & "', '" & text(18) & "', '" & text(19) & "', '" & text(20) & "', '" & text(21) & "') "]
'



Because the syntax of your SQL statement is incorrect.

Show us your SQL statement so we can see it and possibly point out your error.

In addition, whenever you face a problem like this it's a good idea to Response.Write your SQL statement to see what it REALLY says.

Sincerely,
Mark
Sep 14 '07 #3
markrawlingson
346 Expert 100+
The second conn.execute statement looks incorrect.

[conn.execute "insert into enquiry values('" & text(1) & "', '" & text(2) & "', '" & text(3) & "', '" & text(4) & "', '" & text(5) & "', '" & text(6) & "', '" & text(7) & "', '" & text(8) & "', '" & text(9) & "', " & text(10) & ", '" & text(11) & "', '" & text(12) & "', '" & text(13) & "','" & cdate(text(14)) & "', '" & text(15) & "','" & text(16) & "', '" & text(17) & "', '" & text(18) & "', '" & text(19) & "', '" & text(20) & "', '" & text(21) & "') "]

You're specifying values but no fields for them to go into..

The proper syntax for an INSERT INTO statement is as follows..

Expand|Select|Wrap|Line Numbers
  1. Conn.Execute "INSERT INTO Enquiry (column1, column2, column3, column4) VALUES ('value1',Value2',Value3',Value4')
  2.  
Try that. If that doesn't work then Set your SQL statements into a variable...

sSQL = "sql statement"

and response.write it out (Response.Write sSQL).. copy it and post it so we can see what it actually says.

The problem most people have with SQL, especially with dynamically constructed SQL statements, is that they're constructing the statement but they don't actually realize that the statement doesn't say what they intended.. thus it throws an error. Therefore it's always a good idea to spit it out onto the page so you can visually see what statement is being passed to the database. It may look correct in your code, especially if you've been looking at the screen for hours, but what's actually generated may be something completely different!

Sincerely,
Mark
Sep 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Thiko | last post by:
Hi According to the official mysql manual: http://www.mysql.com/doc/en/Charset-SHOW-CHARSET.html The syntax to show all available character sets is the SHOW CHARACTER SET command. It takes...
8
by: Kevin Murphy | last post by:
Using PG 7.4.3 on Mac OS X 10.2.8, the following "insert into ... select ..." statement completed and then announced a syntax error, which seems bizarre. (Don't be confused by the fact that the...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
1
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'." ...
0
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...
3
by: teddymeu | last post by:
Hi Guys, new to development using visual studio and vb.net 2.0. and SQL express. Have a small problem. I have an update command which im using to change the values of a blob image table to NULL...
4
by: cluce | last post by:
I am getting a syntax error but I cant seem to spot it. need help with this. Its when I click the save button that fires my SQL UPDATE query. thansk in advance 'module level declarations Dim...
1
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. ...
1
by: asf93555 | last post by:
Running under SQL2000 I can not get an INSTEAD trigger to function. I've even copied the example directl from books online - no joy . . . Server: Msg 170, Level 15, State 1, Procedure...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

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.