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
| public ResultSet SQLSelect(String sql) throws SQLException {
Statement creerconnec = null;
ResultSet RS = null;
try {
creerconnec = connection.createStatement();
RS = creerconnec.executeQuery(" SELECT Nom du prof,Prènom From Table1 ");
int execut = creerconnec.executeUpdate(sql);
System.out.println("liste des professeurs :");
while(RS.next()){
System.out.println(RS.getString("Nom du prof,Prènom"));
}
}
catch (SQLException e) {
RS.close();
creerconnec.close();
return null;
}
return null;
} |
Partager