1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| String Sql = "Select*from table personne WHERE username"
+txtuser.getText()+"and password"+txtpass.getText()+"";
try
{
ps = cnx.prepareStatement(Sql);
ps.setString(1,txtuser.getText());
ps.setString(1,txtuser.getText());
Rs = ps.executeQuery();
if (Rs.next())
{
JOptionPane.showMessageDialog(null,"correct");
principale s = new principale ();
s.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(null,"invalid username or password");
p.setText("invalid username or password");
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null,e);
}
} |
Partager