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
   | String pilote = "com.mysql.jdbc.Driver";
 
            	        Connection connexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/mabase","root","");
 
 
            	        Statement instruction = connexion.createStatement();
 
            	        try {
            	        	//int effacement_donnee = instruction.executeUpdate("DELETE FROM table_temporaire_code_defaut");
 
            	        	//ResultSet code_1008 = instruction.executeQuery("SELECT * FROM table_temporaire_code_defaut WHERE Caisse LIKE '%26529%' OR '%26530%' OR '%262529%' OR '%262530%' ORDER BY SUBSTRING(Date_heure, 7, 2), SUBSTRING(Date_heure, 4, 2), SUBSTRING(Date_heure, 1, 2),SUBSTRING(Date_heure, 10, 2),SUBSTRING(Date_heure, 13, 2),SUBSTRING(Date_heure, 16, 2),SUBSTRING(Date_heure, 19, 2)"); 
            	        	//ResultSet code_1008 = instruction.executeQuery("SELECT * FROM table_temporaire_code_defaut WHERE Caisse LIKE '%26529%' OR '%26530%' OR '%262529%' OR '%262530%' ORDER BY Date_heure_convertie");
            	        	ResultSet code_1008 = instruction.executeQuery("SELECT * FROM table_temporaire_code_defaut WHERE Caisse LIKE '%26529%' OR '%26530%' OR '%262529%' OR '%262530%' HAVING Date_heure_convertie >= (select max(Date_heure_convertie) from table_temporaire_code_defaut WHERE Code = '1008' and Caisse LIKE '%26529%' OR '%26530%' OR '%262529%' OR '%262530%' ) ORDER BY Date_heure_convertie");
            	        	//ResultSet code_1008_taille = instruction.executeQuery("SELECT COUNT * FROM table_temporaire_code_defaut WHERE Caisse LIKE '%26529%' OR '%26530%' OR '%262529%' OR '%262530%' HAVING Date_heure_convertie >= (select max(Date_heure_convertie) from table_temporaire_code_defaut WHERE Code = '1008' and Caisse LIKE '%26529%' OR '%26530%' OR '%262529%' OR '%262530%' ) ORDER BY Date_heure_convertie");
 
            	        	int i=0; 
            	        	// i indique le nombre de ligne
            	        	while(code_1008.next())
            	        	{
 
 
 
            	        		monTableau1.setValueAt(code_1008.getString("Caisse"), i, 0);
            	        		monTableau1.setValueAt(code_1008.getString("Code"), i, 1);
            	        		monTableau1.setValueAt(code_1008.getString("Date_heure"), i, 2);
            	        		monTableau1.setValueAt(code_1008.getString("Designation"), i, 3);
 
 
            	        	i++;
 
            	        	} | 
Partager