Ver Mensaje Individual
  #6 (permalink)  
Antiguo 17/12/2009, 14:18
yakima
 
Fecha de Ingreso: diciembre-2009
Mensajes: 5
Antigüedad: 15 años, 2 meses
Puntos: 0
Pregunta Respuesta: for input string " "

Hola W:
La verdad es que el ejercicio que estoy haciendo lo estoy haciendo web no en consola, al parecer el problema anterior se ha solucionado , ahora el error que me da es otro. Yo soy principiante en java asi que mis disculpas si no me hago entender bien.
Yo quiero prestar un libro a un cliente, para ello paso por parametros un nombre de cliente y un titulo de libro del cual necesito recoger el id(este lo obtengo con el metodo DevolverIdLibro (aqui es donde la onsulta me da bateo))

el metodo prestar es el siguiente:

public static void PrestarLibro(String nombre,ResultSet idLibro) throws SQLException, Exception {
String query=("update cliente set idLibro= '"+ idLibro +"' where nombre="+ nombre);
getConection().createStatement().execute(query);
}

El problema esta aqui (Servlet) , cuando llega a ResultSet r = AccesoDatos.DevolverIdLibro(nameLibro) se parte en el metodo DevolverIdLibro y el error me dice que no encuentra la columna XXX... donde xxx es el titulo del libro que pase por parametros.

.....
else if(action.equals("prestar_libro") )
{
String nameLibro= request.getParameter("nameLibro");
ResultSet r = AccesoDatos.DevolverIdLibro(nameLibro);
String nombreC= request.getParameter("cliente");

DAO.AccesoDatos.PrestarLibro(nombreC, r);
response.sendRedirect("Inicio.jsp");

}
else
response.sendRedirect("Inicio.jsp");


Metodo DevolverIdLibro

public static ResultSet DevolverIdLibro(String titulo) throws SQLException, Exception {
String query=("select idLibro from libro where titulo="+titulo);
return getConection().createStatement().executeQuery(quer y);
}

Última edición por yakima; 17/12/2009 a las 14:28