public void updAccount(Account a)throws Exception{
String sql = "update account set cardno = ?,amount =?,userId = ? where id =?";
Connection conn = getConnetion();
PreparedStatement pst = conn.prepareStatement(sql);
pst.setInt(1, a.getCredNo());
pst.setInt(2, a.getAmount());
pst.setInt(3, a.getUserId());
pst.setInt(4, a.getId());
int rows = pst.executeUpdate();
// 打印SQL语句
String rsq = ((JDBC4PreparedStatement)pst).asSql();
System.out.println(rsq);
if(rows>0)
System.out.println("修改成功");
else
System.out.println("修改失败");
closeConnection(null, pst, conn);
}