Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/10/2010, 12:10
Avatar de sanchezg
sanchezg
 
Fecha de Ingreso: abril-2009
Mensajes: 76
Antigüedad: 15 años
Puntos: 0
Respuesta: int en lugar de String

jajaja gracias por tu ayuda pero estoy muy guey jajaj porq ahora lo q no me jala son todo los precios :s mi codigo es:

Código:
String SQLString = "SELECT TOP 10 * FROM conceptos";

if (request.getParameterValues("clave").length > 0 ) {
    SQLString = "SELECT * FROM conceptos WHERE clave IN (";
    for (String s : request.getParameterValues("clave")) {
        SQLString += "\'" + s + "\', ";
 	
	}
    SQLString = SQLString.substring(0, SQLString.lastIndexOf(',')) + ")";
}

try { tabla = instruccion.executeQuery(SQLString);
while (tabla.next()) {

float precio = tabla.getFloat(3);
String [] valores = request.getParameterValues("cantidad");

for (int i = 0; i < valores.length; i++)
{
     int cantidad = Integer.parseInt(valores[i]);
     float total = precio * cantidad;

out.println("PRECIO:"+precio+"");
out.println("cantidad:"+cantidad+"");
out.println("total:"+total+"");
}
y me imprime:
PRECIO:10.0 cantidad:3 total:30.0
PRECIO:10.0 cantidad:1 total:10.0
PRECIO:10.0 cantidad:2 total:20.0
cuando segun las claves q consulte precio deberia de ser 10.00, 20.00 y 30.00