Hola que tal tengo el siguiente problema al tratar de hacer algunas consultas me salto el error:
"Before start of result set"
La parte de codigo es:
Código HTML:
try{
int cont = 0;
String descripcion, precio;
Statement st = conn.createStatement();
rs = st.executeQuery("select clave, Nombre, Descripcion, Tipo_Producto, Price_May, Price_Men, Existencias ,Url_Foto from articulo where clave = "+ noid );
descripcion=rs.getString(3);
precio=rs.getString(6);
if(rs.next()){
st.execute("update articulo set Existencias=" + (Integer.parseInt(rs.getString(7))-1) + " where clave =" + noid );
rs = st.executeQuery("select ID_Venta from ventas where Usuario = "+ noid );
if(rs.next()){
cont=Integer.parseInt(rs.getString(1));
st.execute("insert into ventas values( '"+cont+1 +"','"+noid+"', '"+descripcion+"', '"+precio+"', "+ "DATE(NOW()))" );
}
}
} //FIN TRY
catch( SQLException a ){ out.println("Introduzca su numero de cuenta: "+a); }