java - Updating existing Row on database jdbc -


No error is showing, when I click on the button, but the database is not updated on the table.

  string heh = jlabel 17.getText (); Try {stmt.executeUpdate ("update books SET availability = '" + "missing" + "' where book_title = '" + heh + "' ');} hold (SQLException error) {System.out.println (err) .getMessage ());}  

You completely messed up the query ,

  stmt.executeUpdate ("update books SET availability = '" + "missing" + "' where book_ title = '" + + + "' ');  

may be,

  stmt.executeUpdate ("Set availability of books SET availability = 'unavailable' Where book_title = '" + heh + " '');  

You are advised to print the query before executing, because it avoids common mistakes, try to use the prepared statement as well, because your SQL is weak for injection

Read it


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -