coding login menggunakan java
package projec_penjualan;
import
javax.swing.JTable.*;
import
javax.swing.table.DefaultTableModel;
import
javax.swing.JOptionPane;
import
java.text.*;
import
java.sql.*;
import
java.util.*;
private void
bkeluarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
System.exit(1);
}
private void
bokActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
try{
conekdb getCn=new conekdb();
Connection Cn=getCn.konek();
Statement st=Cn.createStatement();
String SQL="SELECT *FROM operator WHERE
userid='"+txtun.getText().trim()+"'&&passid='"+txtpass.getText().trim()+"'";
ResultSet rs=st.executeQuery(SQL);
if(rs.next()){
JOptionPane.showMessageDialog(null,"Selamat Anda Berhasil
Login");
FormMenu mn= new FormMenu();
mn.setVisible(true);
dispose();
}
else{
JOptionPane.showMessageDialog(null,"Username atau Password anda
salah");
}
st.close();
Cn.close();
rs.close();
}catch
(Exception exc){
System.err.println(exc.getMessage());
}
txtun.requestFocus();
Tags:
knowledge
0 comments