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
| package fr.stats.extraction;
import ldap.ldap;
import my_sql.Mysql;
public class NbTotalDispo {
Connection conn;
Statement stat;
ResultSet rs;
public int NbService(String titre)
{
Mysql m = new Mysql() ;
m.Connect( "services" ) ;// connection à la BDD services
int NbS= 0;
String requete="SELECT st_nbHeuresService FROM statut "
+"WHERE st_id='"+ titre +"'";
try{
rs=stat.executeQuery(requete);
while(rs.next())
{
NbS=rs.getInt(1);
}
System.out.println(NbS);
}
catch(SQLException e)
{
System.out.println("Probleme execution requete");
}
return NbS;
}
public static void main(String[] args)throws SQLException {
Mysql sql=new Mysql();
sql.Connect("services");
sql.NbService("Moniteur");
sql.Deconnect();
} |
Partager