java - Updating existing Row on database jdbc -
no error showing when click button table on database doesn't update.
string heh = jlabel17.gettext(); seek { stmt.executeupdate("update books set availability='"+"unavailable"+"' book_title='"+heh+"'"); }catch (sqlexception err) { system.out.println(err.getmessage() ); }
you have messed query totally,
stmt.executeupdate("update books set availability='"+"unavailable"+"' book_title='"+heh+"'");
should be,
stmt.executeupdate("update books set availability='unavailable' book_title='"+heh+"' ");
it advisable print query before execute , avoids mutual mistakes. seek utilize prepared statements yours vulnerable sql injection
read prepared statements , jdbc drivers
java jdbc
No comments:
Post a Comment