Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/11/2003, 14:35
Avatar de kye_z
kye_z
 
Fecha de Ingreso: febrero-2003
Ubicación: barcelona
Mensajes: 18
Antigüedad: 21 años, 4 meses
Puntos: 0
help meee!!!! :D

HOOLA!!
os kuento mi problema... tnego k actualizarel campo DATA_BAIXA de una BDD con la fecha actual del sistema....
he creado el SQL con las dos incognitas que luego le passare. pero al introducir la fecha.. no se yo .. pero algo hago mal!! pk me peta.... os adjunto el metodo que utilizo.. a ver si alguien me puede ayudar..

muchissimas gracias!!!


public void delete (Object pk) throws ExcepcioDAO {
Compte compte = (Compte)pk;
Date d = new Date();
String sql = "UPDATE COMPTE SET DATA_BAIXA = ? WHERE NUM_COMPTE = ?";
PreparedStatement stmt = null;
try {
stmt = con.prepareStatement(sql);
stmt.setDate(1, d); <--- aki es donde me peta!!!
stmt.setString(2, compte.getNum_compte());
int rowcount = stmt.executeUpdate();
if (rowcount != 1) {
throw new ExcepcioDAO("El compte no existeix");
}
} catch (SQLException e) {
throw new ExcepcioDAO("Error en la BD", e);
}
finally {
try {
if (stmt!=null) stmt.close();
if (con!=null) con.close();
} catch (SQLException e) { throw new ExcepcioDAO("Error de comunicació", e); }
}
}
__________________
o0 Kye 0o