Syntax error in my UPDATE..please advise

Ads
 

Syntax error in my UPDATE..please advise

Hi experts,

I tested my code and NetBean IDE gave me the following message:-

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where ID = 2' at line 1 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)

And here's my UPDATE Statement:

String sql = "UPDATE members SET strNRICNO=' " + NRIC
                                + " ', strName=' " + Name + " ', strEmail= ' "
                                + Email + " ', strAddress = ' " + Address + " ',strContact= ' "
                                + Contact + "', strGender = ' " + Gender + "', strRemark =  '"
                                + Remark + "', strAge= '" + Age + "', strQualification= '"
                                + Qualification + "', 
                                + strOccupation ='"
                                + Occupation + "', strSubject= '"
                                + Subject + "', strBudget ='"
                                + Budget + "', where ID = " + selectionId;
                        stmt.executeUpdate(sql);

Please advise how should I change my SQL to use Heidi MySQL.

Tks.

View Answers

July 25, 2011 at 10:56 AM

Here is correct format:

String sql = "UPDATE members SET strNRICNO=' " + NRIC + " ', strName=' " + Name + " ', strEmail= ' " + Email + " ', strAddress = ' " + Address + " ',strContact= ' " + Contact + "', strGender = ' " + Gender + "', strRemark = '" + Remark + "', strAge= '" + Age + "', strQualification= '" + Qualification + "', + strOccupation ='" + Occupation + "', strSubject= '" + Subject + "', strBudget ='" + Budget + "', where ID = " + selectionId+"";
stmt.executeUpdate(sql);

Ads









Related Tutorials/Questions & Answers:
Syntax error in my UPDATE..please advise
Syntax error in my UPDATE..please advise  Hi experts, I tested my...; stmt.executeUpdate(sql); Please advise how should I change my SQL to use Heidi MySQL...) And here's my UPDATE Statement: String sql = "UPDATE members SET strNRICNO
sql syntax error help
sql syntax error help  this query show syntax error .. i am unable to figure it out insert into order (orderdate, dpname, paymethod, tamount...') where is the error ?   Please send the error details and the datatype
Advertisements
ERROR 601 (42P00): Syntax error. Encountered
ERROR 601 (42P00): Syntax error. Encountered   Hi, In HBase program I am executing the insert into query, but it is giving following error: ERROR 601 (42P00): Syntax error. Encountered "insert" at line 1, column 1. How
How to Checking Syntax Error in PHP from Command Line
How to Checking Syntax Error in PHP from Command Line  Checking Syntax Error in PHP from Command Line   PHP allows you to check your script.... It will check the syntax error in your script and show the ??Unexpected token
How to resolve this error The filename, directory name, or volume label syntax is incorrect
How to resolve this error The filename, directory name, or volume label syntax... + createTimeStampStr() + ".PNG"; this my program public class Image... getting this error java.io.FileNotFoundException: http:\www.queen.com
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.  String sql = "UPDATE emp_details SET empEname = ?, emailId = ?, guid =?, proximityCard =?, managerEmailId = ?, reviewerEmailId
I GOT ERROR FOR MY PROJECT
I GOT ERROR FOR MY PROJECT  Dear Friend/ RoseIndia Team, Firstly I would to thank u Guys help me so many time.. I got error on my little project when running at server. please correctly my error Guys... ERROR CODE: "LOGIN
MY Sql Query Error - Not able to Understand the issue
MY Sql Query Error - Not able to Understand the issue  I am new... tblFeedback WHERE UID = UID ORDER BY InsertedTS DESC INTO @MostRecentFID; UPDATE... END I am getting an error as follow: Schema Creation Failed: You have an error
Upgraded MySQL from 5.1 to 5.5, running into PDOException: SQLSTATE[42000]: Syntax error or
Upgraded MySQL from 5.1 to 5.5, running into PDOException: SQLSTATE[42000]: Syntax error or  Upgraded MySQL from 5.1 to 5.5, running into PDOException: SQLSTATE[42000]: Syntax error or
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
how do i update my database with the help of update syntax in html <text/javascript>? How to write 'where' statement in this?
how do i update my database with the help of update syntax in html ? How to write 'where' statement in this?  var sqlmek="update into Student_info...'); alert('Press OK to Update your Records Successfully
ModuleNotFoundError: No module named 'syntax'
ModuleNotFoundError: No module named 'syntax'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named..., ModuleNotFoundError: No module named 'syntax' error will be solved. Thanks
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
ModuleNotFoundError: No module named 'hilite-syntax'
ModuleNotFoundError: No module named 'hilite-syntax'  Hi, My... 'hilite-syntax' error? Thanks   Hi, In your python...;hilite-syntax' error will be solved. Thanks
ModuleNotFoundError: No module named 'json-syntax'
ModuleNotFoundError: No module named 'json-syntax'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named...;json-syntax' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'moshmosh-syntax'
ModuleNotFoundError: No module named 'moshmosh-syntax'  Hi, My... 'moshmosh-syntax' error? Thanks   Hi, In your python... named 'moshmosh-syntax' error will be solved. Thanks
ModuleNotFoundError: No module named 'ninja_syntax'
ModuleNotFoundError: No module named 'ninja_syntax'  Hi, My Python...;ninja_syntax' error? Thanks   Hi, In your python..._syntax' error will be solved. Thanks
ModuleNotFoundError: No module named 'syntax-diagram'
ModuleNotFoundError: No module named 'syntax-diagram'  Hi, My... 'syntax-diagram' error? Thanks   Hi, In your python... 'syntax-diagram' error will be solved. Thanks
ModuleNotFoundError: No module named 'syntax-diagram'
ModuleNotFoundError: No module named 'syntax-diagram'  Hi, My... 'syntax-diagram' error? Thanks   Hi, In your python... 'syntax-diagram' error will be solved. Thanks
ModuleNotFoundError: No module named 'syntax_sugar'
ModuleNotFoundError: No module named 'syntax_sugar'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named...;syntax_sugar' error? Thanks   Hi, In your python
syntax for create a table
syntax for create a table  syntax for create a table
Can someone review my script for an apparent parsing error? -it isn't quite finished yet, but I want to fix error first
Can someone review my script for an apparent parsing error? -it isn't quite finished yet, but I want to fix error first   import java.util.Scanner; class historyquiz{ public static void main(String args
javascript comment syntax html
javascript comment syntax html  javascript comment syntax html
ModuleNotFoundError: No module named 'cmsplugin_syntax_highlight'
, My Python program is throwing following error: ModuleNotFoundError... the ModuleNotFoundError: No module named 'cmsplugin_syntax_highlight' error? Thanks...;cmsplugin_syntax_highlight' error will be solved. Thanks
ModuleNotFoundError: No module named 'cmsplugin_syntax_highlight'
, My Python program is throwing following error: ModuleNotFoundError... the ModuleNotFoundError: No module named 'cmsplugin_syntax_highlight' error? Thanks...;cmsplugin_syntax_highlight' error will be solved. Thanks
ModuleNotFoundError: No module named 'dash-annotated-syntax-highlighter'
ModuleNotFoundError: No module named 'dash-annotated-syntax-highlighter'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'dash-annotated-syntax-highlighter' How to remove
ModuleNotFoundError: No module named 'Seki-C-syntax-highlighter'
, My Python program is throwing following error: ModuleNotFoundError... the ModuleNotFoundError: No module named 'Seki-C-syntax-highlighter' error? Thanks  ...-syntax-highlighter' error will be solved. Thanks
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about

Ads