Código:
y el error q me da ese stepublic void insertarHistorial (Historial his) { try{ com.mysql.jdbc.Driver driver = (com.mysql.jdbc.Driver)Class.forName ("com.mysql.jdbc.Driver").newInstance (); java.sql.Connection connection = DriverManager.getConnection ("jdbc:mysql://localhost/Hospital", "user", "user"); java.sql.Statement stmt = connection.createStatement(); java.util.Date fech = new java.util.Date(); String codigo = Long.toString(fech.getTime()); codigo = codigo + Integer.toString((int)(Math.random() * 1000)); stmt.executeUpdate("insert into historial(codigo,cod_medico,cod_paciente,fecha,hora,concepto,descripcion) values('"+codigo+"','"+his.getMedico()+"','"+his.getPaciente()+"','"+his.getFecha()+"','"+his.getHora()+"','"+his.getConcepto()+"','"+his.getDescripcion()+"')"); stmt.close(); connection.close(); }catch(Exception e){ System.out.println("error al insertar en la BD de Historial al insertar historial"+e.getMessage()); } }
Column count doesn't match value count at row 1