SHARE
TWEET

contoh script login dengan Java

ajiperdana Nov 10th, 2015 192 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try {
  2.             Connection con = koneksi.Koneksi();
  3.             String sql = "Select * from user where u_name = '" + jTextField1.getText().trim() + "'" + "and u_pass = '" + jTextField2.getText + "'";
  4.             Statement stat = con.createStatement();
  5.             ResultSet res = stat.executeQuery(sql);
  6.             if (res.next()) { //cek inputan, jika cocok maka akan dialihkan ke Form HalamanUtama()
  7.                 JOptionPane.showMessageDialog(null, "Anda Berhasil Login!", "Peringatan", JOptionPane.INFORMATION_MESSAGE);
  8.                 new HalamanUtama().setVisible(true);
  9.                 dispose(); //untuk menyembunyikan form ini
  10.             } else {
  11.                 JOptionPane.showMessageDialog(null, "Anda Gagal Login!", "Peringatan", JOptionPane.WARNING_MESSAGE);
  12.                 jTextField1.requestFocusInWindow();
  13.                 jTextField1.setText("");
  14.                 jTextField2.setText("");
  15.             }
  16.         } catch (Exception ex) {
  17.             System.out.println("kesalahan :" + ex.toString());
  18.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top