Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnGuardarInvActionPerformed(java.awt.event.ActionEvent evt) {
- Connection con = null;
- try {
- con = getConnection();
- ps = con.prepareStatement("INSERT INTO inventario (articulo, sucursal, existencia, marca)VALUES(?,?,?,?)");
- ps.setString(1, txtArticuloInv.getText());
- ps.setString(2, txtSucursalInv.getText());
- ps.setInt(3, Integer.parseInt(txtExistenciaInv.getText()));
- ps.setString(4, txtMarcaInv.getText());
- int res = ps.executeUpdate();
- if (res > 0) {
- borrarDatos();
- } else {
- JOptionPane.showMessageDialog(null, "Error al guardar");
- borrarDatos();
- }
- con.close();
- } catch (Exception e) {
- System.err.println("Error de conexion");
- }
- }
Add Comment
Please, Sign In to add comment