Advertisement
JVFabia

ejercicioDAO

Oct 9th, 2020
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. package com.forge.project.jdbc.dao;
  2.  
  3. import com.forge.project.jdbc.ConnectionManager;
  4.  
  5. import java.sql.Connection;
  6. import java.sql.PreparedStatement;
  7. import java.sql.SQLException;
  8.  
  9.  
  10. public class EjerciciosDAO {
  11.  
  12.     private Connection connection;
  13.  
  14.     public EjerciciosDAO() throws SQLException{
  15.         this.connection = ConnectionManager.obtenerConexion();
  16.     }
  17.  
  18.     public void editarDeporteEjercicio(String nombre, String apellido, String deporte) throws SQLException {
  19.         String sql = "update ejercicios \n" +
  20.                 "set deporte = ?\n" +
  21.                 "where nombre = ? and apellido = ?";
  22.         PreparedStatement ps = connection.prepareStatement(sql);
  23.         ps.setString(1, nombre);
  24.         ps.setString(2, apellido);
  25.         ps.setString(3, deporte);
  26.         ps.execute();
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement