Skip to content

Commit 21153ff

Browse files
committed
Added delete overloaded with id
1 parent 92fd458 commit 21153ff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Unit14/src/unit14/Actividad15_Aplicacion/DAO/EmpleadoDAO.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,18 @@ public void delete(Empleado empleado) {
142142
System.out.println("Error al eliminar el empleado");
143143
}
144144
}
145+
}
145146

147+
public void delete(int id) {
148+
if (conexion != null) {
149+
String query = "DELETE FROM empleado WHERE numemp = ?";
150+
try (PreparedStatement ps = conexion.prepareStatement(query)) {
151+
ps.setInt(1, id);
152+
ps.executeUpdate();
153+
} catch (SQLException e) {
154+
System.out.println("Error al eliminar el empleado");
155+
}
156+
}
146157
}
147158

148159
private Empleado extractEmpleadoFromResultSet(ResultSet rs) throws SQLException {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy