Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- Connection con = koneksi.Koneksi();
- String sql = "Select * from user where u_name = '" + jTextField1.getText().trim() + "'" + "and u_pass = '" + jTextField2.getText + "'";
- Statement stat = con.createStatement();
- ResultSet res = stat.executeQuery(sql);
- if (res.next()) { //cek inputan, jika cocok maka akan dialihkan ke Form HalamanUtama()
- JOptionPane.showMessageDialog(null, "Anda Berhasil Login!", "Peringatan", JOptionPane.INFORMATION_MESSAGE);
- new HalamanUtama().setVisible(true);
- dispose(); //untuk menyembunyikan form ini
- } else {
- JOptionPane.showMessageDialog(null, "Anda Gagal Login!", "Peringatan", JOptionPane.WARNING_MESSAGE);
- jTextField1.requestFocusInWindow();
- jTextField1.setText("");
- jTextField2.setText("");
- }
- } catch (Exception ex) {
- System.out.println("kesalahan :" + ex.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement