I have a SQL query that I have copied from MYSQL and I have removed the quotation, but it does work Does not seem to be.
conn = connect (); SelectStatement = "Update Student Set Item? = ?, Type? =? Where ID =?";;; Println (selectStatement); If (conn! = Null) {readyStatement = conn.prepareStatement (selectStatement); ReadyStatement.setString (2, id); ReadyStatement.setInt (1, place); ReadyStatement.setInt (3, place); ReadyStatement.setString (4, type); ReadyStatement.setString (5, userId); ReadyStatement.executeUpdate (); Back true; I'm not sure why this does not work because this exception is thrown
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error Is your SQL syntax; To use near '1' = 'Sadness', check the manual related to your message SQL Server version for the correct syntax, type 1 =' edid 'WHERE id =' student1 '' on line1 < / Div>
Finally it worked
conn = connect (); SelectStatement = "Update item of student set" + location + "` = ',' type '+ location + "` =' WHERE id =? ' ;; Println (selectStatement); If (conn! = Null) {readyStatement = conn.prepareStatement (selectStatement); ReadyStatement.setString (1, ID); ReadyStatement.setString (2, type); ReadyStatement.setString (3, User ID); ReadyStatement.executeUpdate (); Back true; }
No comments:
Post a Comment