0
jtable 및 rs2xml.jar 라이브러리를 사용하고 있습니다.jtable에서 행의 합계
테이블에 3 개의 열이 있습니다. 이드, 이름, 금액 금액의 합계를 계산하고 싶습니다.
//showcal is my table name
try {
Connection conn = getConnection();
PreparedStatement ps
= conn.prepareStatement("select id,name,amount from income where idate=?");
ps.setString(1,((JTextField) inpdatechosser.getDateEditor().getUiComponent()).getText());
rset = ps.executeQuery();
showcal.setModel(DbUtils.resultSetToTableModel(rset));
//sum calculation
int total = 0;
for (int i = 0; i < showcal.getRowCount(); i++){
int amount = Integer.parseInt(showcal.getValueAt(i, 3).toString());
total =total+ amount;
}
jTextField1.setText(""+Integer.toString(total));
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
하지만 아무것도 일어나지 : 여기
는 코드입니다. 나는 "3> = 3"을 얻고있다. 그게 무슨 뜻이야 ?? 왜 작동하지 않는거야 ??
예 ... 나는 그 부분을 ... 그리워합니다. –