private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:CAUNOI","","");
Statement stm= con.createStatement();
String sql="select * from Dangnhap where Ma='" + txtMa.getText().trim() + "'and Pass='" + txtPass.getText().trim()+"'";
ResultSet kq=stm.executeQuery(sql);
if(kq.next())
{
lbThongbao.setText("Dang nhap thanh cong");
lbThongbao.setBackground(Color.BLUE);
}
else
{
lbThongbao.setText("Dang nhap that bai");
lbThongbao.setBackground(Color.RED);
}
stm.close();
con.close();
}catch(ClassNotFoundException | SQLException e){
System.out.println("Loi roi" + e.getMessage());
}
}