0
嗨我想從一個表使用SQL查詢帶來的結果,但我得到的消息SQLServerResultSet3
作爲結果。Sqlserver在joptionpane中顯示結果與sql查詢
我以下面的代碼爲例,但它不適用於我,任何想法我做錯了,因爲我是新的這種ty!
searching from database and showing the output
private void searchquantity(){
//ArrayList <Update_del_insert_products> proList =new ArrayList <Update_del_insert_products>();
Connection connection =getConnection();
String query ="SELECT * FROM Products WHERE Pro_Quantity <=20";
Statement sts=null;
ResultSet rsr=null;
try{
sts = connection.createStatement();
rsr = sts.executeQuery(query);
//Update_del_insert_products update_del_insert_products ;
if(rsr.next()) {
JOptionPane.showMessageDialog(null,rsr);
}else{
JOptionPane.showMessageDialog(null, "Not Found");
}
}catch (Exception e) { JOptionPane.showMessageDialog(null, e); }
}
====================================== ===========================
private void Check_CapacityActionPerformed(java.awt.event.ActionEvent evt) {
searchquantity();
}
什麼「不工作」? – StanislavL
我沒有得到顯着的產品,低於20 ....我想要顯示的產品 –
,所以我想要帶來的結果到joptionpane爲exable所有產品低於20 –