JSP (Java Server Page) - Variables en un while

 
Vista:

Variables en un while

Publicado por JJ (45 intervenciones) el 30/01/2002 22:11:24
Hola
Tengo un while donde quiero declarar 2 variables, pero al hacerlo me sale un error:

10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request

El código es este=

<%
Statement stmt2 = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);

ResultSet rsTable2 = stmt2.executeQuery("SELECT DISTINCT(DEPT2) FROM TBDISTR WHERE DEPT1 LIKE '"+selectedbox1+"'");
while (rsTable2.next())
{
String DBdept1=rsTable2.getString("dept1");
String DBdept2=rsTable2.getString("dept2");
out.println("<option>"+DBdept2+"</option>");
}%>

Espero me puedan ayudar
Gracias
JJ
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Variables en un while

Publicado por Cris (7 intervenciones) el 31/01/2002 11:04:54
Lo que te ocurre es que estas intentado recoger dept1 y en tu Select solo estas obteniendo dept2, es lo que te ocurre, que ese valor no lo estas obteniendo con la consulta, o bien eliminas la variable DBdept1, porque por lo que veo no la estas utilizando para nada, o bien, si la vas a necesitar tendrias que sacarla tambien en la select: SELECT DISTINCT(DEPT2), DEPT1 FROM TBDISTR WHERE DEPT1 LIKE '"+selectedbox1+"'";

Espero que te sirva de ayuda
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Excelente, esa fue la respuesta

Publicado por JJ (45 intervenciones) el 31/01/2002 21:39:22
Muchas gracias

=)

JJ
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar