public class Valeur extends javax.swing.JFrame {
Vector vdata=null;
private void chargerTableau() {
Date d = new Date(jTextField1.getText());
System.out.println(d);
vdata= getListevaleur(d);
Vector vcolonnename=(Vector)vdata.elementAt(0);
vdata.removeElementAt(0);
tablegroupe.setModel(new DefaultTableModel(vdata,vcolonnename));
}
public Valeur() {
initComponents();
}
public static Vector getListevaleur(Date d) {
Vector vdata=new Vector();
ResultSet rs=null;
try{
Connection conn=BDConnection.connecter();
Statement stmt=null;
try{
stmt= (Statement) conn.createStatement();
rs=stmt.executeQuery("select * from Valeur ");
ResultSetMetaData rsmd=rs.getMetaData();
int colonneccount=rsmd.getColumnCount();
Vector vcolonnename = new Vector();
for (int i =1; i<= colonneccount ;i++)vcolonnename.addElement(rsmd.getColumnName(i));
vdata.addElement(vcolonnename);
Vector vligne;
while(rs.next()){
System.out.println(rs.getString("d"));
vligne = new Vector();
for(int i=1 ;i<=colonneccount ; i++) vligne.addElement(rs.getObject(i));
vdata.addElement(vligne);
}
}
finally{
rs.close();
stmt.close();
BDConnection.deconnecter();
}
}
catch(Exception e){}
return vdata;
}
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
Date d = new Date(jTextField1.getText());
// getListevaleur(d);
chargerTableau();
chargerid();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Valeur().setVisible(true);
}
});
}[/code]
public class Valeur extends javax.swing.JFrame {
Vector vdata=null;
private void chargerTableau() {
Date d = new Date(jTextField1.getText());
System.out.println(d);
vdata= getListevaleur(d);
Vector vcolonnename=(Vector)vdata.elementAt(0);
vdata.removeElementAt(0);
tablegroupe.setModel(new DefaultTableModel(vdata,vcolonnename));
}
public Valeur() {
initComponents();
}
public static Vector getListevaleur(Date d) {
Vector vdata=new Vector();
ResultSet rs=null;
try{
Connection conn=BDConnection.connecter();
Statement stmt=null;
try{
stmt= (Statement) conn.createStatement();
rs=stmt.executeQuery("select * from Valeur ");
ResultSetMetaData rsmd=rs.getMetaData();
int colonneccount=rsmd.getColumnCount();
Vector vcolonnename = new Vector();
for (int i =1; i<= colonneccount ;i++)vcolonnename.addElement(rsmd.getColumnName(i));
vdata.addElement(vcolonnename);
Vector vligne;
while(rs.next()){
System.out.println(rs.getString("d"));
vligne = new Vector();
for(int i=1 ;i<=colonneccount ; i++) vligne.addElement(rs.getObject(i));
vdata.addElement(vligne);
}
}
finally{
rs.close();
stmt.close();
BDConnection.deconnecter();
}
}
catch(Exception e){}
return vdata;
}
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
Date d = new Date(jTextField1.getText());
// getListevaleur(d);
chargerTableau();
chargerid();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Valeur().setVisible(true);
}
});
}[/code]