Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OKbtnActionPerformed(java.awt.event.ActionEvent evt)
- {
- try{
- String password = PassJP.getText();
- int passint = Integer.parseInt(password);
- conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/banking application","root","");
- String query = "SELECT Balance FROM user WHERE Password =" +passint;
- Statement st = conn.createStatement();
- ResultSet rs = st.executeQuery(query);
- int balance = rs.getInt("Balance");
- String WAmmount = WithAmmTF.getText();
- int WAmmountint = Integer.parseInt(WAmmount);
- int newbalance = balance - WAmmountint;
- Statement s=conn.createStatement();
- s.executeUpdate("INSERT INTO `user`(Balance) VALUE ('"+newbalance+"') where Password="+ passint);
- conn.close();
- }
- catch (SQLException e) {
- System.err.println("Got an exception! ");
- System.err.println(e.getMessage());
- }
Add Comment
Please, Sign In to add comment