i have an error with my Code, but i don't know what is... (Java + MySQL)
public void deleteClientes(int nit){
sql = "DELETE FROM `clientes` WHERE `clientes`.`nit` = ";
delete(sql,nit);
}
Method that receives:
public void delete(String sql,int id){
final QueryRunner qr = new QueryRunner(true);
try {
qr.update(conexion(),sql,"%"+id+"%");
} catch (SQLException ex) {
System.err.println("Error"+ex);
}
}
Your query doesn't have a placeholder ?
. It should be:
"DELETE FROM `clientes` WHERE `clientes`.`nit` = ?"
Need to add ?
into sql statement where data will be placed based on parameter
sql = "DELETE FROM `clientes` WHERE `clientes`.`nit` = ?";
and
qr.update(conexion(),sql,id);
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.