This commit is contained in:
medhi.rodrigues 2025-03-14 08:09:42 +01:00
parent 5a923ab0f6
commit 57de42ffa6
3 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,48 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
* @author medhi.rodrigues
*/
public class visiteurSQL {
private Connection connexionTest;
private Statement stmt = null;
private ResultSet result = null;
public visiteurSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public ArrayList<String> rechercherVisiteur(String login, String mdp) {
ArrayList<String> visiteurCherche = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Accès à la table
result = stmt.executeQuery("SELECT * FROM PRATICIENLOG WHERE nom='"+login+
"' AND Mdp='"+mdp + "';");
if (result.next()) { // Le praticien a été touvé
visiteurCherche.add(result.getString(1));
visiteurCherche.add(result.getString(2));
}
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 visiteurCherche;
}
}

View File

@ -10,6 +10,7 @@ import acces_aux_donnes.familleMedocSQL;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
/**
*
@ -146,7 +147,7 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
}else {
//ajout d'un JoptionPane
JOptionPane.showMessageDialog(null,"Veuillez choisir un médicament valide");
}
}//GEN-LAST:event_jBRechercheValideActionPerformed

View File

@ -15,6 +15,7 @@ public class jffProfession extends javax.swing.JFrame {
*/
public jffProfession() {
initComponents();
}
/**