Menu login diatas adalah menu yang udah q buat selama PKL di United Tracktors, menu tersebut untuk operator/admin bagian penerima Calon Siswa UT School yang mendaftar secara online, meski masih banyak kekurangan tapi bangga sih bisa bikin sendiri, ni q kasih source code nya. Semoga bermanfaat
private void loginActionPerformed(java.awt.event.ActionEvent evt) {
Connection conn = null;
ResultSet rs=null;
JOptionPane konfirmasi=new JOptionPane();
try{
Class.forName("com.mysql.jdbc.Driver");
conn= (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/pendaftaran","root","");
String sql="select * from admin where (user=? && pass=?)";
PreparedStatement statement = (PreparedStatement) conn.prepareStatement(sql);
statement.setString(1, username.getText());
statement.setString(2, passwd.getText());
rs=statement.executeQuery();
if(rs.next()){
konfirmasi.showConfirmDialog(null, new String("Selamat Bekerja "),"Sukses !",konfirmasi.PLAIN_MESSAGE);
lt.setVisible(false);
username.setText("");
passwd.setText("");
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Administrasi().setVisible(true);
}
});
}
else{
konfirmasi.showConfirmDialog(null, new String("Nama user atau password yang anda masukkan salah !"),"Error Login !",konfirmasi.PLAIN_MESSAGE);
username.setText("");
passwd.setText("");
}
statement.close();
conn.close();
}
catch(SQLException se){
System.out.println(se.getMessage());
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
Free Template Blogger
collection template
Hot Deals
BERITA_wongANteng
SEO
theproperty-developer
Rabu, 22 Agustus 2012
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar