hi,can anybody tell reason for getting syntax error near , while either updating or inserting records in table
3 2301
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
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
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.. -
Conn.Execute "INSERT INTO Enquiry (column1, column2, column3, column4) VALUES ('value1',Value2',Value3',Value4')
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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'."
...
|
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...
|
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...
|
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...
|
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. ...
|
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...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| | |