这是我的代码:
请检查
有问题
结果集代码正常工作
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
try {
new MyProject();
model1.setRowCount(0);
Statement s1=MyProject.conn.createStatement();
ResultSet rs=s1.executeQuery("select * from myproject4");
while(rs.next()) {
//System.out.println("147");
s1.executeUpdate("insert into myproject2(cname,caddress,saleId,SNo,Name,Price,Quantity,Tax,total,Date)values('"
+ rs.getString("cname") + "','" + rs.getString("caddress") + "','" + rs.getString("saleId")
+ "','" + rs.getString("sno") + "','" + rs.getString("Name") + "','"
+ rs.getString("Price") + "','" + rs.getString("Quantity") + "','" + rs.getString("Tax")
+ "','" + rs.getString("total") + "','" + rs.getString("Date") + "')");
}
s1.executeUpdate("delete from myproject4");
jTextField5.setText("");
jTextField6.setText("");
model1.setRowCount(0);
money=JOptionPane.showInputDialog("Grand total - " + gtotal + '\n' + "Enter Money");
money1=Double.valueOf(money)-gtotal;
JOptionPane.showMessageDialog(this, "Change - " + money1);
new NewJFrame6().setVisible(true);
} catch(SQLException | HeadlessException | NumberFormatException e) {
System.out.println(e);
}
}
结果集正在运行,但明显的progran发生的异常没有进一步运行