familleMedoc fini

This commit is contained in:
2025-03-13 12:43:43 +01:00
parent 37842afdeb
commit a3b3f4d093
3 changed files with 216 additions and 25 deletions

View File

@@ -6,8 +6,10 @@ package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Vector;
/**
*
@@ -22,6 +24,65 @@ public class familleMedocSQL {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public Vector<String> rechercheFamille(){
Vector<String> famille = new Vector<String>();
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT fLibelle FROM FAMILLE;");
while(result.next()) { // Le praticien a <20>t<EFBFBD> touv<75>
famille.add(result.getString(1));
}
result.close();
stmt.close();
}catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());
System.out.println("Code erreur : " + ex.getErrorCode());
}
return famille;
}
public String rechercheCodeFamille(String libelle){
String code = "";
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT fCode FROM FAMILLE WHERE fLibelle ='"+ libelle +"';");
while(result.next()) { // Le praticien a <20>t<EFBFBD> touv<75>
code = result.getString(1);
}
result.close();
stmt.close();
}catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());
System.out.println("Code erreur : " + ex.getErrorCode());
}
return code;
}
public Vector<String> rechercherMedocFamille(String libelle){
Vector<String> famille = new Vector<String>();
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT mNomCommercial FROM MEDICAMENT WHERE fCode ='"+ libelle +"';");
while(result.next()) { // Le praticien a <20>t<EFBFBD> touv<75>
famille.add(result.getString(1));
}
result.close();
stmt.close();
}catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());
System.out.println("Code erreur : " + ex.getErrorCode());
}
return famille;
}