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
|
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:gmi";
Connection con = DriverManager.getConnection(url, "", "");
Statement creerconnec = con.createStatement();
String sql = "select * from compte_utilisateur where login = '" + jTextField1.getText() + "' and password ='" + jTextField2.getText() + "';";
ResultSet RS = creerconnec.executeQuery(sql);
while (RS.next()) {
if (RS.getString("login").equals(jTextField1.getText()) && RS.getString("password").equals(jTextField2.getText()))
{
if (RS.getString("fonction").equals("Administrateur")) {
interface_menu i_m = new interface_menu();
i_m.setVisible(true);
} else if (RS.getString("fonction").equals("Ingenieur")) {
interface_menu_Ingénieur i_m = new interface_menu_Ingénieur();
i_m.setVisible(true);
} else {
interface_menu_technicien i_m = new interface_menu_technicien();
i_m.setVisible(true);
}
}
}
con.close(); |
Partager