У меня получилась эта ошибка: java.sql.SQLException: Illegal operation on empty result set.
Я не понимаю, почему, я петлю в конечном итоге поиск строк с течением времени.Illegal ResultSet
rs1=st1.executeQuery("select product.price,product.id from product,warehouse,shop
where product.brand ='"
+ Brand
+ "' and product.productType='"
+ Product
+ "'and shop.quantity + warehouse.quantity='"
+ Quantity
+ "' and product.id=shop.idProduct");
while (rs1.next()) {
price = rs.getInt("price");
idProduct = rs.getString("id");
countWareHouse++;
}
if (countWareHouse > 0) {
JOptionPane.showConfirmDialog(Sale,
"Do you want to add this " + Product
+ "int the cart?", "CART",
JOptionPane.OK_CANCEL_OPTION);
Prices.add(price);
}
}
Не могли бы вы отобразить полный код? –
Вы не показали нам код, который является виновником. Что есть в цикле 'while'. И используйте 'PreparedStatement' для построения запроса. –
'Brand',' Product' и 'Quantity' должны быть параметрами, чтобы избежать атак с SQL-инъекциями. – dasblinkenlight