Advertisement
16112

mysql

Apr 14th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.     Connection conn = null;
  2.     ResultSet rs = null;
  3.     PreparedStatement pst = null;
  4.  
  5.  
  6.  
  7.  
  8. public void actionPerformed(ActionEvent e) {
  9.                 try {
  10.                 String sql = "SELECT * FROM `loginform` where users=? and password=?";
  11.                 pst = conn.prepareStatement(sql);
  12.                 pst.setString(1, users.getText());
  13.                 pst.setString(2, password.getText());
  14.                 rs = pst.executeQuery();
  15.                 if(rs.next()) {
  16.                     JOptionPane.showMessageDialog(null, "YES!");
  17.                 } else {
  18.                     JOptionPane.showMessageDialog(null, "NO!");
  19.                 }
  20.                 }catch (Exception e1) {
  21.                     JOptionPane.showMessageDialog(null, e1);
  22.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement