DBUtil util = new DBUtil();
try {
JOptionPane.showMessageDialog(null, "Connection Opened!");
Connection con = util.getConnection();
PreparedStatement stmt = con.prepareStatement("SELECT (SUM(box_no),SUM(weight),SUM(TP),SUM(TV)) FROM dbo.mut_det WHERE rm_id=?");
stmt.setInt(1, Integer.parseInt(rm));// but how to get values from textfield dont know.
//*and how to put these called values SUM(box_no),SUM(weight),SUM(TP),SUM(TV) in textfields dnt know.*//
//my textfields are txtboxno, txtweight, txttp, txttv
stmt.execute();
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, null, ex);
}
您看到无法获取并将值放回文本字段...