je suis débutant en java,
j'ai une classe qui comporte plusieurs jLabel et JText Field, un bouton 'quitter'
le champs ''identifiant'' je le récupère en passant par une carte électronique, ( c'est bon ça marche )
et une autre classe dans laquelle je me connecte à une base de donnée, et j'affiche les informations correspondantes à un identifiant,
mon problème c'est que, je veux qu'après récupération de l'identifiant avec ma carte, je l'utilise pour afficher les informations correspondantes à cet identifant,
public class App_graphique extends javax.swing.JFrame {
Statement stmt ;
connect_DB maConnexion = new connect_DB();
// Creates new form App_graphique
public App_graphique() {
initComponents();
CodeBadge=t1;
}
public static javax.swing.JTextField CodeBadge;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
l1 = new javax.swing.JLabel();
l2 = new javax.swing.JLabel();
l3 = new javax.swing.JLabel();
l4 = new javax.swing.JLabel();
l5 = new javax.swing.JLabel();
t1 = new javax.swing.JTextField();
t2 = new javax.swing.JTextField();
t3 = new javax.swing.JTextField();
t4 = new javax.swing.JTextField();
b3 = new javax.swing.JToggleButton();
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
l6 = new javax.swing.JLabel();
l7 = new javax.swing.JLabel();
l8 = new javax.swing.JLabel();
l9 = new javax.swing.JLabel();
t5 = new javax.swing.JTextField();
t7 = new javax.swing.JTextField();
t6 = new javax.swing.JTextField();
t8 = new javax.swing.JTextField();
t9 = new javax.swing.JTextField();
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
try {
Statement stmt = conn.createStatement();
try {
ResultSet rs = stmt.executeQuery( "SELECT * FROM personnel_entreprise WHERE identifiant = 'aa123'" );
try {
while ( rs.next() ) {
int numColumns = rs.getMetaData().getColumnCount();
for ( int i = 1 ; i <= numColumns ; i++ ) {
// Column numbers start at 1.
// Also there are many methods on the result set to return
// the column as a particular type. Refer to the Sun documentation
// for the list of valid conversions.
System.out.println( "COLUMN " + i + " = " + rs.getObject(i) );
}
}
} finally {
try { rs.close(); } catch (Throwable ignore) { /* Propagate the original exception
instead of this one that you may want just logged */ }
}
} finally {
try { stmt.close(); } catch (Throwable ignore) { /* Propagate the original exception
instead of this one that you may want just logged */ }
}
} finally {
//It's important to close the connection when you are done with it
try { conn.close(); } catch (Throwable ignore) { /* Propagate the original exception
instead of this one that you may want just logged */ }
}