ajiperdana

contoh script login dengan Java

Nov 10th, 2015
643
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×