I need your help please! I have a problem at the level of the delete it goes very well at the console but at the level in the database no changes. Thanks for you help
public void b2_action() {
try {
String req ="DELETE from EMPLOYEES where 'FIRST_NAME' = (?)";
conn = macon.getConnection();
PreparedStatement ps = conn.prepareStatement(req);
String a= text.getValue().toString();
System.out.println(a);
ps.setString(1,a);
ps.executeUpdate();
System.out.println("okkkkkkkkkkkkkkk");
} catch (SQLException ex) {
ex.printStackTrace();
}
}
The query must be:
String req ="DELETE from EMPLOYEES where FIRST_NAME = ?";
note the remotion of the single quotes... ' '
There are few mistakes in your query:
FIRST_NAME
between quotes?
String req = "DELETE from EMPLOYEES where FIRST_NAME = ?";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.