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
| private void initialize() {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(44, 85, 209, 91));
this.setSize(300, 200);
this.setLayout(null);
this.add(getList(), null);
this.add(jLabel, null);
try{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
connect = DriverManager.getConnection("jdbc:odbc:gestionparcinformatique");
Statement stm = connect.createStatement();
ResultSet rst = stm.executeQuery("select * from employes");
while (rst.next()){
jLabel.setText(rst.getString("prenom"));
}
rst.close();
stm.close();
connect.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} |
Partager