Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void AumentarEstoque(int id, float qntd) {
- String sql = "UPDATE produtos SET qntdEstoque = qntd WHERE id = ?";
- Connection conn = null;
- PreparedStatement x = null;
- try {
- conn = Conexao.createConnectionToMySQL();
- x = conn.prepareStatement(sql);
- x.setInt(1, id);
- x.setFloat(2, qntd);
- x.execute();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- if (x != null) {
- x.close();
- }
- if (conn != null) {
- conn.close();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement