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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
public void actionPerformed(ActionEvent e)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection("jdbc:odbc:gescom");
Statement st=c.createStatement();
String req="select * from utila where log='"+ t1.getText() +"'";
ResultSet res = st.executeQuery(req);
int existe = 0;
while(res.next())
{
existe=1;
}
if(existe == 0)
{
JOptionPane.showMessageDialog(null,"user not found ????");
}
else
{
new menup().setVisible(true);
}
c.close();
}
catch(ClassNotFoundException e22)
{
JOptionPane.showMessageDialog(null,"erreur de pilote");
}
catch(SQLException l)
{
JOptionPane.showMessageDialog(null,"erreur de requete");
}
}
public static void main(String [] arg)
{
new sec().setVisible(true);
}
} |
Partager